Skip to content

Commit

Permalink
update test
Browse files Browse the repository at this point in the history
  • Loading branch information
evanchooly committed Aug 26, 2023
1 parent 26807ca commit 4948894
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions core/src/test/java/dev/morphia/test/TestUpdateOperations.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);

Expand All @@ -576,9 +578,9 @@ public void testMaxWithDates() {
@Test
public void testMinWithDates() {
List<User> 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)
Expand All @@ -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);

Expand Down

0 comments on commit 4948894

Please sign in to comment.