TSK-1972: Use Mondays instead of Sundays for tests

a) That makes it easier to reason about
b) Complex cases (like starting on non working days) are tests in
WorkingTimeCalculatorImplTest
This commit is contained in:
Jochen Just 2023-02-27 15:58:29 +01:00 committed by Mustapha Zorgati
parent b916d577ca
commit d33c16e790
1 changed files with 8 additions and 8 deletions

View File

@ -87,7 +87,7 @@ class ServiceLevelOfAllTasksAccTest {
@WithAccessId(user = "user-1-1") @WithAccessId(user = "user-1-1")
@Test @Test
void should_SetPlannedOnMultipleTasks() throws Exception { void should_SetPlannedOnMultipleTasks() throws Exception {
Instant planned = Instant.parse("2020-05-03T07:00:00.000Z"); // Sunday Instant planned = Instant.parse("2020-05-03T07:00:00.000Z");
TaskSummary task1 = TaskSummary task1 =
createDefaultTask() createDefaultTask()
.classificationSummary(classificationSummarySmallServiceLevel) .classificationSummary(classificationSummarySmallServiceLevel)
@ -117,7 +117,7 @@ class ServiceLevelOfAllTasksAccTest {
@Test @Test
void should_ChangeDue_When_SettingPlannedAndClassificationHasSmallerServiceLevel() void should_ChangeDue_When_SettingPlannedAndClassificationHasSmallerServiceLevel()
throws Exception { throws Exception {
Instant planned = Instant.parse("2020-05-03T07:00:00.000Z"); // Sunday Instant planned = Instant.parse("2020-05-04T07:00:00.000Z");
TaskSummary task1 = TaskSummary task1 =
createDefaultTask() createDefaultTask()
.classificationSummary(classificationSummarySmallServiceLevel) .classificationSummary(classificationSummarySmallServiceLevel)
@ -135,7 +135,7 @@ class ServiceLevelOfAllTasksAccTest {
assertThat(bulkLog.containsErrors()).isFalse(); assertThat(bulkLog.containsErrors()).isFalse();
List<TaskSummary> result = List<TaskSummary> result =
taskService.createTaskQuery().idIn(task1.getId(), task2.getId()).list(); taskService.createTaskQuery().idIn(task1.getId(), task2.getId()).list();
Instant expectedDue = Instant.parse("2020-05-05T23:00:00.000Z"); Instant expectedDue = Instant.parse("2020-05-06T07:00:00.000Z");
assertThat(result).extracting(TaskSummary::getDue).containsOnly(expectedDue); assertThat(result).extracting(TaskSummary::getDue).containsOnly(expectedDue);
} }
@ -143,7 +143,7 @@ class ServiceLevelOfAllTasksAccTest {
@Test @Test
void should_ChangeDue_When_SettingPlannedAndAttachmentHasSmallerOrEqualServiceLevel() void should_ChangeDue_When_SettingPlannedAndAttachmentHasSmallerOrEqualServiceLevel()
throws Exception { throws Exception {
Instant planned = Instant.parse("2020-05-03T07:00:00.000Z"); Instant planned = Instant.parse("2020-05-04T07:00:00.000Z");
TaskSummary task1 = TaskSummary task1 =
createDefaultTask() createDefaultTask()
.classificationSummary(classificationSummaryGreatServiceLevel) .classificationSummary(classificationSummaryGreatServiceLevel)
@ -162,14 +162,14 @@ class ServiceLevelOfAllTasksAccTest {
assertThat(bulkLog.containsErrors()).isFalse(); assertThat(bulkLog.containsErrors()).isFalse();
List<TaskSummary> result = List<TaskSummary> result =
taskService.createTaskQuery().idIn(task1.getId(), task2.getId()).list(); taskService.createTaskQuery().idIn(task1.getId(), task2.getId()).list();
Instant expectedDue = Instant.parse("2020-05-05T23:00:00.000Z"); Instant expectedDue = Instant.parse("2020-05-06T07:00:00.000Z");
assertThat(result).extracting(TaskSummary::getDue).containsOnly(expectedDue); assertThat(result).extracting(TaskSummary::getDue).containsOnly(expectedDue);
} }
@WithAccessId(user = "user-1-1") @WithAccessId(user = "user-1-1")
@Test @Test
void should_ChangeDue_When_SettingPlannedAndUsingDifferentServiceLevels() throws Exception { void should_ChangeDue_When_SettingPlannedAndUsingDifferentServiceLevels() throws Exception {
Instant planned = Instant.parse("2020-05-03T07:00:00.000Z"); Instant planned = Instant.parse("2020-05-04T07:00:00.000Z");
TaskSummary task1 = TaskSummary task1 =
createDefaultTask() createDefaultTask()
.classificationSummary(classificationSummaryGreatServiceLevel) .classificationSummary(classificationSummaryGreatServiceLevel)
@ -193,8 +193,8 @@ class ServiceLevelOfAllTasksAccTest {
assertThat(bulkLog.containsErrors()).isFalse(); assertThat(bulkLog.containsErrors()).isFalse();
List<TaskSummary> result = List<TaskSummary> result =
taskService.createTaskQuery().idIn(task1.getId(), task2.getId(), task3.getId()).list(); taskService.createTaskQuery().idIn(task1.getId(), task2.getId(), task3.getId()).list();
Instant expectedDueSmallServiceLevel = Instant.parse("2020-05-05T23:00:00.000Z"); Instant expectedDueSmallServiceLevel = Instant.parse("2020-05-06T07:00:00.000Z");
Instant expectedDueGreatServiceLevel = Instant.parse("2020-05-12T23:00:00.000Z"); Instant expectedDueGreatServiceLevel = Instant.parse("2020-05-13T07:00:00.000Z");
assertThat(result) assertThat(result)
.extracting(TaskSummary::getDue) .extracting(TaskSummary::getDue)
.containsOnly(expectedDueSmallServiceLevel, expectedDueGreatServiceLevel); .containsOnly(expectedDueSmallServiceLevel, expectedDueGreatServiceLevel);