Skip to content

Commit

Permalink
add ReportDay test
Browse files Browse the repository at this point in the history
  • Loading branch information
bseber committed Nov 15, 2024
1 parent 16d2bc6 commit e282f08
Showing 1 changed file with 28 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,34 @@ robinIdComposite, new WorkingTimeCalendar(Map.of(reportDate, new PlannedWorkingH
assertThat(sut.plannedWorkingHours().duration()).isEqualTo(Duration.ofHours(12));
}

@Test
void ensurePlannedWorkingHoursByUser() {

final UserIdComposite batmanIdComposite = new UserIdComposite(new UserId("uuid"), new UserLocalId(1L));
final UserIdComposite robinIdComposite = new UserIdComposite(new UserId("uuid2"), new UserLocalId(2L));
final UserIdComposite jokerIdComposite = new UserIdComposite(new UserId("uuid3"), new UserLocalId(3L));

final LocalDate reportDate = LocalDate.of(2024, 11, 13);

final ReportDay sut = new ReportDay(
reportDate,
Map.of(
batmanIdComposite, new WorkingTimeCalendar(Map.of(reportDate, PlannedWorkingHours.EIGHT), Map.of()),
robinIdComposite, new WorkingTimeCalendar(Map.of(reportDate, new PlannedWorkingHours(Duration.ofHours(4))), Map.of()),
// enforce empty optional value while calculating planned working hours
// which then use the fallback value of ZERO
jokerIdComposite, new WorkingTimeCalendar(Map.of(reportDate.plusDays(1), PlannedWorkingHours.EIGHT), Map.of())
),
Map.of(),
Map.of());

assertThat(sut.plannedWorkingHoursByUser()).isEqualTo(Map.of(
batmanIdComposite, PlannedWorkingHours.EIGHT,
robinIdComposite, new PlannedWorkingHours(Duration.ofHours(4)),
jokerIdComposite, PlannedWorkingHours.ZERO)
);
}

@Test
void ensureToRemoveBreaks() {

Expand Down

0 comments on commit e282f08

Please sign in to comment.