JAVA-2824 Fix tests in Java 9 and above modules
This commit is contained in:
@@ -92,6 +92,7 @@
|
||||
<!-- util -->
|
||||
<commons-math3.version>3.6.1</commons-math3.version>
|
||||
<joda.version>2.10</joda.version>
|
||||
<lombok.version>1.18.12</lombok.version>
|
||||
<!-- testing -->
|
||||
<assertj.version>3.6.1</assertj.version>
|
||||
<asspectj.version>1.8.9</asspectj.version>
|
||||
|
||||
@@ -54,13 +54,17 @@ public class ElapsedTimeUnitTest {
|
||||
@Test
|
||||
public void givenRunningTask_whenMeasuringTimeWithInstantClass_thenGetElapsedTime() throws InterruptedException {
|
||||
Instant start = Instant.now();
|
||||
System.out.println("start: " + start);
|
||||
|
||||
simulateRunningTask();
|
||||
|
||||
Instant finish = Instant.now();
|
||||
|
||||
|
||||
System.out.println("start: " + start);
|
||||
System.out.println("finish: " + finish);
|
||||
long timeElapsed = Duration.between(start, finish).toMillis();
|
||||
|
||||
|
||||
System.out.println("elapsed: " + timeElapsed);
|
||||
assertEquals(true, (2000L <= timeElapsed) && (timeElapsed <= 3000L));
|
||||
}
|
||||
|
||||
|
||||
@@ -21,12 +21,8 @@ public class LocalDateTimeUnitTest {
|
||||
@Test
|
||||
public void givenLocalDateTimeMock_whenNow_thenGetFixedLocalDateTime() {
|
||||
Clock clock = Clock.fixed(Instant.parse("2014-12-22T10:15:30.00Z"), ZoneId.of("UTC"));
|
||||
LocalDateTime dateTime = LocalDateTime.now(clock);
|
||||
mockStatic(LocalDateTime.class);
|
||||
when(LocalDateTime.now()).thenReturn(dateTime);
|
||||
String dateTimeExpected = "2014-12-22T10:15:30";
|
||||
|
||||
LocalDateTime now = LocalDateTime.now();
|
||||
LocalDateTime now = LocalDateTime.now(clock);
|
||||
|
||||
assertThat(now).isEqualTo(dateTimeExpected);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user