Replies: 1 comment 1 reply
-
Like: Database database = DB.getDefault();
final Instant snapshot = Instant.now();
Instant backedSnapshot = snapshot.minus(1, ChronoUnit.DAYS);
Clock snapshotClock = Clock.fixed(backedSnapshot, Clock.systemUTC().getZone());
database.extended().setClock(snapshotClock); So via Now, when you look at that you'll see it is deprecated. This is because I really want to move this setClock() method somewhere else as every other method on that ExtendedServer is deprecated with a better option for folks to migrate to. So at this stage setClock() would be the only method on that interface so I was kind of thinking I should move it or find some better way to support exactly this case ... as we really only need this setClock() method to support testing. So although setClock() is deprecated I actually don't have a good plan for how to support this for tests in the future yet. Use extended().setClock() for now ... and I'll work on getting a good / better solution for the "we only need this setClock() method for testing ... " |
Beta Was this translation helpful? Give feedback.
-
Hi,
Is there any chance to modify the clock used by WhenModified in tests?
There is a field updatedAt with @WhenModified.
I have to create an entity and then modify it and check if the updatedAt field is eg. 10 minutes after the previous value.
I've been searching and the only way I found is DatabaseConfig.setClock() but it can be made only before Database is created.
I need to modify this time when a database is already created.
Beta Was this translation helpful? Give feedback.
All reactions