-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[BE] refactor: LocalDateTime.now() 사용을 LocalDateTime.now(clock) 형식으로 …
…변경 (#395) (#400) * refactor: LocalDateTime.now(Clock) 형식으로 변경 * test: 현재 시간 -> 고정된 시간으로 변경 * test: Clock의 instant를 생성하는 support class 추가 * test: TimeInstantProvider 메소드 명 변경 --------- Co-authored-by: hyunseo <[email protected]>
- Loading branch information
1 parent
43e9785
commit 93d8aee
Showing
5 changed files
with
73 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
backend/src/test/java/com/festago/support/TimeInstantProvider.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package com.festago.support; | ||
|
||
import java.time.Instant; | ||
import java.time.LocalDateTime; | ||
import java.time.ZoneId; | ||
import java.time.ZonedDateTime; | ||
|
||
public class TimeInstantProvider { | ||
|
||
public static Instant from(String localDateTime) { | ||
return from(LocalDateTime.parse(localDateTime)); | ||
} | ||
|
||
public static Instant from(LocalDateTime localDateTime) { | ||
return Instant.from(ZonedDateTime.of(localDateTime, ZoneId.systemDefault())); | ||
} | ||
} |