Skip to content

Commit

Permalink
Code smells fixed, first class refactored into interface
Browse files Browse the repository at this point in the history
  • Loading branch information
larslnde committed Dec 17, 2024
1 parent a96bd2c commit 6cfcea1
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 15 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package uk.gov.hmcts.reform.wataskmonitor.domain.jobs;

public class CaseIdList {
public interface CaseIdList {
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
@ToString
@EqualsAndHashCode(callSuper = false)
@Getter
public class ElasticSearchCaseList extends CaseIdList {
public class ElasticSearchCaseList implements CaseIdList {

private final int total;
private final List<ElasticSearchCase> cases;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
@ToString
@EqualsAndHashCode(callSuper = false)
@Getter
public class JsonResourceCaseList extends CaseIdList {
public class JsonResourceCaseList implements CaseIdList {

List<String> caseIds;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,15 +53,13 @@ public void checkUnTerminatedTasks(String serviceToken) {
String.join(", ", processIds)
);

camundaTasks.forEach(task -> {
log.warn("{} -> taskId:{} deleteReason:{} startTime:{} endTime:{}",
TASK_TERMINATION_FAILURES.name(),
task.getId(),
task.getDeleteReason(),
task.getStartTime(),
task.getEndTime()
);
});
camundaTasks.forEach(task -> log.warn("{} -> taskId:{} deleteReason:{} startTime:{} endTime:{}",
TASK_TERMINATION_FAILURES.name(),
task.getId(),
task.getDeleteReason(),
task.getStartTime(),
task.getEndTime()
));

}
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ void should_return_active_tasks_and_not_delayed_tasks(CapturedOutput output) thr
assertQueryTargetsUserTasksAndNotDelayedTasks();
assertQuery();
assertThat(genericJobReport.getTotalTasks()).isEqualTo(camundaTasks.size());
assertThat(genericJobReport.getOutcomeList().size()).isEqualTo(camundaTasks.size());
assertThat(genericJobReport.getOutcomeList()).hasSameSizeAs(camundaTasks.size());
assertTrue(genericJobReport.getOutcomeList().get(0).isSuccessful());
assertThat(output.getOut()).contains("TASK_INITIATION_FAILURES There are some uninitiated tasks");

Expand All @@ -118,7 +118,7 @@ void should_return_empty_list_when_camundaTasks_is_empty(CapturedOutput output)
assertQueryTargetsUserTasksAndNotDelayedTasks();
assertQuery();
assertThat(genericJobReport.getTotalTasks()).isZero();
assertThat(genericJobReport.getOutcomeList().size()).isZero();
assertTrue(genericJobReport.getOutcomeList().isEmpty());
assertThat(output.getOut()).contains("TASK_INITIATION_FAILURES There was no task");
}

Expand Down Expand Up @@ -149,7 +149,7 @@ void should_return_isSuccessful_false_when_an_exception_thrown() throws JSONExce
assertQueryTargetsUserTasksAndNotDelayedTasks();
assertQuery();
assertThat(genericJobReport.getTotalTasks()).isEqualTo(camundaTasks.size());
assertThat(genericJobReport.getOutcomeList().size()).isEqualTo(camundaTasks.size());
assertThat(genericJobReport.getOutcomeList()).hasSameSizeAs(camundaTasks.size());
assertFalse(genericJobReport.getOutcomeList().get(0).isSuccessful());
}

Expand Down

0 comments on commit 6cfcea1

Please sign in to comment.