Skip to content

Commit

Permalink
chain assertions
Browse files Browse the repository at this point in the history
  • Loading branch information
bseber authored and derTobsch committed May 17, 2023
1 parent 2c2a315 commit 7a1a712
Showing 1 changed file with 29 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -788,17 +788,18 @@ void ensureGetEntriesForAllUsers() {
final ZonedDateTime expectedBreakStart = ZonedDateTime.of(entryBreakStart, ZONE_ID_UTC);
final ZonedDateTime expectedBreakEnd = ZonedDateTime.of(entryBreakEnd, ZONE_ID_UTC);

assertThat(actual).hasSize(2);
assertThat(actual).hasEntrySatisfying(batmanLocalId, timeEntries -> {
assertThat(timeEntries).containsExactly(
new TimeEntry(new TimeEntryId(1L), new UserId("batman"), "hard work", expectedStart, expectedEnd, false)
);
});
assertThat(actual).hasEntrySatisfying(pinguinLocalId, timeEntries -> {
assertThat(timeEntries).containsExactly(
new TimeEntry(new TimeEntryId(2L), new UserId("pinguin"), "deserved break", expectedBreakStart, expectedBreakEnd, true)
);
});
assertThat(actual)
.hasSize(2)
.hasEntrySatisfying(batmanLocalId, timeEntries -> {
assertThat(timeEntries).containsExactly(
new TimeEntry(new TimeEntryId(1L), new UserId("batman"), "hard work", expectedStart, expectedEnd, false)
);
})
.hasEntrySatisfying(pinguinLocalId, timeEntries -> {
assertThat(timeEntries).containsExactly(
new TimeEntry(new TimeEntryId(2L), new UserId("pinguin"), "deserved break", expectedBreakStart, expectedBreakEnd, true)
);
});
}

@Test
Expand Down Expand Up @@ -834,17 +835,18 @@ void ensureGetEntriesByUserLocalIds() {
final ZonedDateTime expectedBreakStart = ZonedDateTime.of(entryBreakStart, ZONE_ID_UTC);
final ZonedDateTime expectedBreakEnd = ZonedDateTime.of(entryBreakEnd, ZONE_ID_UTC);

assertThat(actual).hasSize(2);
assertThat(actual).hasEntrySatisfying(batmanLocalId, timeEntries -> {
assertThat(timeEntries).containsExactly(
new TimeEntry(new TimeEntryId(1L), new UserId("uuid-1"), "hard work", expectedStart, expectedEnd, false)
);
});
assertThat(actual).hasEntrySatisfying(robinLocalId, timeEntries -> {
assertThat(timeEntries).containsExactly(
new TimeEntry(new TimeEntryId(2L), new UserId("uuid-2"), "deserved break", expectedBreakStart, expectedBreakEnd, true)
);
});
assertThat(actual)
.hasSize(2)
.hasEntrySatisfying(batmanLocalId, timeEntries -> {
assertThat(timeEntries).containsExactly(
new TimeEntry(new TimeEntryId(1L), new UserId("uuid-1"), "hard work", expectedStart, expectedEnd, false)
);
})
.hasEntrySatisfying(robinLocalId, timeEntries -> {
assertThat(timeEntries).containsExactly(
new TimeEntry(new TimeEntryId(2L), new UserId("uuid-2"), "deserved break", expectedBreakStart, expectedBreakEnd, true)
);
});
}

@Test
Expand All @@ -862,10 +864,11 @@ void ensureGetEntriesByUserLocalIdsReturnsValuesForEveryAskedUserLocalId() {

final Map<UserLocalId, List<TimeEntry>> actual = sut.getEntriesByUserLocalIds(from, toExclusive, List.of(batmanLocalId));

assertThat(actual).hasSize(1);
assertThat(actual).hasEntrySatisfying(batmanLocalId, timeEntries -> {
assertThat(timeEntries).isEmpty();
});
assertThat(actual)
.hasSize(1)
.hasEntrySatisfying(batmanLocalId, timeEntries -> {
assertThat(timeEntries).isEmpty();
});
}

@Test
Expand Down

0 comments on commit 7a1a712

Please sign in to comment.