Skip to content

Commit 62918cd

Browse files
bseberderTobsch
authored andcommitted
chain assertions
1 parent 53be6de commit 62918cd

File tree

1 file changed

+29
-26
lines changed

1 file changed

+29
-26
lines changed

src/test/java/de/focusshift/zeiterfassung/timeentry/TimeEntryServiceImplTest.java

Lines changed: 29 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -788,17 +788,18 @@ void ensureGetEntriesForAllUsers() {
788788
final ZonedDateTime expectedBreakStart = ZonedDateTime.of(entryBreakStart, ZONE_ID_UTC);
789789
final ZonedDateTime expectedBreakEnd = ZonedDateTime.of(entryBreakEnd, ZONE_ID_UTC);
790790

791-
assertThat(actual).hasSize(2);
792-
assertThat(actual).hasEntrySatisfying(batmanLocalId, timeEntries -> {
793-
assertThat(timeEntries).containsExactly(
794-
new TimeEntry(new TimeEntryId(1L), new UserId("batman"), "hard work", expectedStart, expectedEnd, false)
795-
);
796-
});
797-
assertThat(actual).hasEntrySatisfying(pinguinLocalId, timeEntries -> {
798-
assertThat(timeEntries).containsExactly(
799-
new TimeEntry(new TimeEntryId(2L), new UserId("pinguin"), "deserved break", expectedBreakStart, expectedBreakEnd, true)
800-
);
801-
});
791+
assertThat(actual)
792+
.hasSize(2)
793+
.hasEntrySatisfying(batmanLocalId, timeEntries -> {
794+
assertThat(timeEntries).containsExactly(
795+
new TimeEntry(new TimeEntryId(1L), new UserId("batman"), "hard work", expectedStart, expectedEnd, false)
796+
);
797+
})
798+
.hasEntrySatisfying(pinguinLocalId, timeEntries -> {
799+
assertThat(timeEntries).containsExactly(
800+
new TimeEntry(new TimeEntryId(2L), new UserId("pinguin"), "deserved break", expectedBreakStart, expectedBreakEnd, true)
801+
);
802+
});
802803
}
803804

804805
@Test
@@ -834,17 +835,18 @@ void ensureGetEntriesByUserLocalIds() {
834835
final ZonedDateTime expectedBreakStart = ZonedDateTime.of(entryBreakStart, ZONE_ID_UTC);
835836
final ZonedDateTime expectedBreakEnd = ZonedDateTime.of(entryBreakEnd, ZONE_ID_UTC);
836837

837-
assertThat(actual).hasSize(2);
838-
assertThat(actual).hasEntrySatisfying(batmanLocalId, timeEntries -> {
839-
assertThat(timeEntries).containsExactly(
840-
new TimeEntry(new TimeEntryId(1L), new UserId("uuid-1"), "hard work", expectedStart, expectedEnd, false)
841-
);
842-
});
843-
assertThat(actual).hasEntrySatisfying(robinLocalId, timeEntries -> {
844-
assertThat(timeEntries).containsExactly(
845-
new TimeEntry(new TimeEntryId(2L), new UserId("uuid-2"), "deserved break", expectedBreakStart, expectedBreakEnd, true)
846-
);
847-
});
838+
assertThat(actual)
839+
.hasSize(2)
840+
.hasEntrySatisfying(batmanLocalId, timeEntries -> {
841+
assertThat(timeEntries).containsExactly(
842+
new TimeEntry(new TimeEntryId(1L), new UserId("uuid-1"), "hard work", expectedStart, expectedEnd, false)
843+
);
844+
})
845+
.hasEntrySatisfying(robinLocalId, timeEntries -> {
846+
assertThat(timeEntries).containsExactly(
847+
new TimeEntry(new TimeEntryId(2L), new UserId("uuid-2"), "deserved break", expectedBreakStart, expectedBreakEnd, true)
848+
);
849+
});
848850
}
849851

850852
@Test
@@ -862,10 +864,11 @@ void ensureGetEntriesByUserLocalIdsReturnsValuesForEveryAskedUserLocalId() {
862864

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

865-
assertThat(actual).hasSize(1);
866-
assertThat(actual).hasEntrySatisfying(batmanLocalId, timeEntries -> {
867-
assertThat(timeEntries).isEmpty();
868-
});
867+
assertThat(actual)
868+
.hasSize(1)
869+
.hasEntrySatisfying(batmanLocalId, timeEntries -> {
870+
assertThat(timeEntries).isEmpty();
871+
});
869872
}
870873

871874
@Test

0 commit comments

Comments
 (0)