From 49488943dfc2c5748e354d32ea2d3a91280194b2 Mon Sep 17 00:00:00 2001 From: evanchooly Date: Sat, 26 Aug 2023 00:16:40 -0400 Subject: [PATCH] update test --- .../java/dev/morphia/test/TestUpdateOperations.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/core/src/test/java/dev/morphia/test/TestUpdateOperations.java b/core/src/test/java/dev/morphia/test/TestUpdateOperations.java index b5449b8bb41..c8f467ac98e 100644 --- a/core/src/test/java/dev/morphia/test/TestUpdateOperations.java +++ b/core/src/test/java/dev/morphia/test/TestUpdateOperations.java @@ -102,7 +102,9 @@ import static dev.morphia.query.updates.UpdateOperators.unset; import static dev.morphia.query.updates.UpdateOperators.xor; import static java.lang.String.format; +import static java.time.LocalDate.now; import static java.time.temporal.ChronoUnit.DAYS; +import static java.time.temporal.ChronoUnit.MONTHS; import static java.util.Arrays.asList; import static java.util.Collections.singletonList; import static org.hamcrest.CoreMatchers.is; @@ -551,7 +553,7 @@ public void testMaxWithDates() { getDs().save(entities); UpdateResult updated = getDs().find(User.class) - .update(max("joined", LocalDate.now())) + .update(max("joined", now())) .execute(new UpdateOptions().multi(true)); assertEquals(updated.getModifiedCount(), 3); @@ -576,9 +578,9 @@ public void testMaxWithDates() { @Test public void testMinWithDates() { List entities = List.of( - new User("User 1", LocalDate.of(2003, 7, 13)), - new User("User 2", LocalDate.of(2009, 12, 1)), - new User("User 3", LocalDate.of(2015, 8, 19))); + new User("User 1", now().minus(1, MONTHS)), + new User("User 2", now().minus(2, MONTHS)), + new User("User 3", now().minus(3, MONTHS))); getDs().save(entities); UpdateResult updated = getDs().find(User.class) @@ -589,7 +591,7 @@ public void testMinWithDates() { getDs().find(User.class).delete(); getDs().save(entities); updated = getDs().find(User.class) - .update(min("joined", Instant.now().minus(5000, DAYS))) + .update(min("joined", Instant.now().minus(70, DAYS))) .execute(new UpdateOptions().multi(true)); assertEquals(updated.getModifiedCount(), 2);