Overriding System time for testing (#4779)
* Overriding System time for testing * Remove Joda Date Time examples
This commit is contained in:
committed by
maibin
parent
a9e4ebff6d
commit
2fec9da2d5
+9
@@ -0,0 +1,9 @@
|
||||
package com.baeldung.aspect;
|
||||
|
||||
public aspect ChangeCallsToCurrentTimeInMillisMethod {
|
||||
long around():
|
||||
call(public static native long java.lang.System.currentTimeMillis())
|
||||
&& within(user.code.base.pckg.*) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.baeldung.util;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
import java.time.Clock;
|
||||
import java.time.Instant;
|
||||
@@ -9,6 +10,8 @@ import java.time.LocalTime;
|
||||
import java.time.ZoneId;
|
||||
import java.time.temporal.ChronoField;
|
||||
|
||||
import org.joda.time.DateTime;
|
||||
import org.joda.time.DateTimeUtils;
|
||||
import org.junit.Test;
|
||||
|
||||
public class CurrentDateTimeUnitTest {
|
||||
@@ -39,5 +42,4 @@ public class CurrentDateTimeUnitTest {
|
||||
|
||||
assertEquals(clock.instant().getEpochSecond(), now.getEpochSecond());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user