From b123348a8af4cbee2f97fff345da9b534b353a08 Mon Sep 17 00:00:00 2001 From: Mustapha Zorgati <15628173+mustaphazorgati@users.noreply.github.com> Date: Thu, 27 Jul 2023 23:14:03 +0200 Subject: [PATCH] fixed tests --- .../taskana/task/internal/ServiceLevelHandler.java | 12 +++++++----- ...velPriorityWithWorkingDaysCalculationAccTest.java | 2 +- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/lib/taskana-core/src/main/java/pro/taskana/task/internal/ServiceLevelHandler.java b/lib/taskana-core/src/main/java/pro/taskana/task/internal/ServiceLevelHandler.java index d463b62287..f9bb37b545 100644 --- a/lib/taskana-core/src/main/java/pro/taskana/task/internal/ServiceLevelHandler.java +++ b/lib/taskana-core/src/main/java/pro/taskana/task/internal/ServiceLevelHandler.java @@ -333,11 +333,13 @@ private Instant normalizeDue(Instant due) { // plusMillis since due is inclusive, but calculation happens exclusive. // minusMillis since we calculated a due date // Without that some edge case fail (e.g. due is exactly the start of weekend) - Instant normalize = - taskanaEngine.getEngine().getConfiguration().isUseWorkingTimeCalculation() - ? due.plusMillis(1) - : due; - return workingTimeCalculator.subtractWorkingTime(normalize, Duration.ZERO); + if (taskanaEngine.getEngine().getConfiguration().isUseWorkingTimeCalculation()) { + return workingTimeCalculator + .subtractWorkingTime(due.plusMillis(1), Duration.ZERO) + .minusMillis(1); + } + + return workingTimeCalculator.subtractWorkingTime(due, Duration.ZERO); } private Instant normalizePlanned(Instant instant) { diff --git a/lib/taskana-core/src/test/java/acceptance/task/ServiceLevelPriorityWithWorkingDaysCalculationAccTest.java b/lib/taskana-core/src/test/java/acceptance/task/ServiceLevelPriorityWithWorkingDaysCalculationAccTest.java index a9fcf4f219..989c1aae53 100644 --- a/lib/taskana-core/src/test/java/acceptance/task/ServiceLevelPriorityWithWorkingDaysCalculationAccTest.java +++ b/lib/taskana-core/src/test/java/acceptance/task/ServiceLevelPriorityWithWorkingDaysCalculationAccTest.java @@ -544,7 +544,7 @@ void should_UpdateTaskPlannedOrDue_When_PlannedOrDueAreOnWeekends_ServiceLevel_P task = taskService.updateTask(task); assertThat(task.getPlanned()) .isEqualTo(getInstant("2020-04-09T07:00:00")); // Thursday (skip Good Friday) - assertThat(task.getDue()).isEqualTo(getInstant("2020-04-091:00:00")); + assertThat(task.getDue()).isEqualTo(getInstant("2020-04-09T07:00:00")); // due changed, planned is null task.setDue(getInstant("2020-04-11T07:00:00")); // Saturday