generated from hmcts/ia-task-configuration
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into FPET-1030-revert-event-access
- Loading branch information
Showing
13 changed files
with
2,354 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
66 changes: 66 additions & 0 deletions
66
...v/hmcts/reform/prl/taskconfiguration/dmn/CamundaTaskCompletionForExceptionRecordTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
package uk.gov.hmcts.reform.prl.taskconfiguration.dmn; | ||
|
||
import org.camunda.bpm.dmn.engine.DmnDecisionTableResult; | ||
import org.camunda.bpm.dmn.engine.impl.DmnDecisionTableImpl; | ||
import org.camunda.bpm.engine.variable.VariableMap; | ||
import org.camunda.bpm.engine.variable.impl.VariableMapImpl; | ||
import org.hamcrest.MatcherAssert; | ||
import org.junit.jupiter.api.BeforeAll; | ||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.params.ParameterizedTest; | ||
import org.junit.jupiter.params.provider.Arguments; | ||
import org.junit.jupiter.params.provider.MethodSource; | ||
import uk.gov.hmcts.reform.prl.taskconfiguration.DmnDecisionTableBaseUnitTest; | ||
|
||
import java.util.List; | ||
import java.util.Map; | ||
import java.util.stream.Stream; | ||
|
||
import static java.util.Arrays.asList; | ||
import static org.hamcrest.CoreMatchers.is; | ||
import static org.hamcrest.MatcherAssert.assertThat; | ||
import static uk.gov.hmcts.reform.prl.taskconfiguration.DmnDecisionTable.WA_TASK_COMPLETION_EXCEPTION_RECORD; | ||
|
||
class CamundaTaskCompletionForExceptionRecordTest extends DmnDecisionTableBaseUnitTest { | ||
|
||
@BeforeAll | ||
public static void initialization() { | ||
CURRENT_DMN_DECISION_TABLE = WA_TASK_COMPLETION_EXCEPTION_RECORD; | ||
} | ||
|
||
static Stream<Arguments> scenarioProvider() { | ||
|
||
return Stream.of( | ||
Arguments.of( | ||
"createException", | ||
asList( | ||
Map.of( | ||
"taskType", "reviewExceptionBulkScanRecord", | ||
"completionMode", "Auto" | ||
) | ||
) | ||
) | ||
); | ||
} | ||
|
||
@ParameterizedTest(name = "event id: {0} post event state: {1}") | ||
@MethodSource("scenarioProvider") | ||
void event_ids_should_evaluate_dmn(String eventId, List<Map<String, String>> expectation) { | ||
|
||
VariableMap inputVariables = new VariableMapImpl(); | ||
inputVariables.putValue("eventId", eventId); | ||
|
||
DmnDecisionTableResult dmnDecisionTableResult = evaluateDmnTable(inputVariables); | ||
MatcherAssert.assertThat(dmnDecisionTableResult.getResultList(), is(expectation)); | ||
} | ||
|
||
@Test | ||
void if_this_test_fails_needs_updating_with_your_changes() { | ||
|
||
//The purpose of this test is to prevent adding new rows without being tested | ||
DmnDecisionTableImpl logic = (DmnDecisionTableImpl) decision.getDecisionLogic(); | ||
assertThat(logic.getInputs().size(), is(1)); | ||
assertThat(logic.getOutputs().size(), is(2)); | ||
assertThat(logic.getRules().size(), is(1)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
73 changes: 73 additions & 0 deletions
73
...mcts/reform/prl/taskconfiguration/dmn/CamundaTaskConfigurationForExceptionRecordTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
package uk.gov.hmcts.reform.prl.taskconfiguration.dmn; | ||
|
||
|
||
import org.camunda.bpm.dmn.engine.DmnDecisionTableResult; | ||
import org.camunda.bpm.dmn.engine.impl.DmnDecisionTableImpl; | ||
import org.camunda.bpm.engine.variable.VariableMap; | ||
import org.camunda.bpm.engine.variable.impl.VariableMapImpl; | ||
import org.junit.jupiter.api.BeforeAll; | ||
import org.junit.jupiter.api.Test; | ||
import uk.gov.hmcts.reform.prl.taskconfiguration.DmnDecisionTable; | ||
import uk.gov.hmcts.reform.prl.taskconfiguration.DmnDecisionTableBaseUnitTest; | ||
|
||
import java.util.Map; | ||
|
||
import static org.hamcrest.CoreMatchers.is; | ||
import static org.hamcrest.MatcherAssert.assertThat; | ||
import static org.junit.jupiter.api.Assertions.assertTrue; | ||
|
||
class CamundaTaskConfigurationForExceptionRecordTest extends DmnDecisionTableBaseUnitTest { | ||
|
||
@BeforeAll | ||
public static void initialization() { | ||
CURRENT_DMN_DECISION_TABLE = DmnDecisionTable.WA_TASK_CONFIGS_EXCEPTION_RECORD; | ||
} | ||
|
||
@Test | ||
void if_this_test_fails_needs_updating_with_your_changes() { | ||
//The purpose of this test is to prevent adding new rows without being tested | ||
DmnDecisionTableImpl logic = (DmnDecisionTableImpl) decision.getDecisionLogic(); | ||
assertThat(logic.getInputs().size(), is(2)); | ||
assertThat(logic.getOutputs().size(), is(3)); | ||
assertThat(logic.getRules().size(), is(6)); | ||
} | ||
|
||
@Test | ||
void when_given_task_type_then_return_dueDateIntervalDays() { | ||
VariableMap inputVariables = new VariableMapImpl(); | ||
inputVariables.putValue("taskType", "reviewExceptionBulkScanRecord"); | ||
|
||
DmnDecisionTableResult dmnDecisionTableResult = evaluateDmnTable(inputVariables); | ||
|
||
assertTrue(dmnDecisionTableResult.getResultList().contains(Map.of( | ||
"name", "dueDateIntervalDays", | ||
"value", "1" | ||
))); | ||
|
||
assertTrue(dmnDecisionTableResult.getResultList().contains(Map.of( | ||
"name", "majorPriority", | ||
"value", "1000" | ||
))); | ||
|
||
assertTrue(dmnDecisionTableResult.getResultList().contains(Map.of( | ||
"name", "workType", | ||
"value", "routine_work" | ||
))); | ||
|
||
assertTrue(dmnDecisionTableResult.getResultList().contains(Map.of( | ||
"name", "roleCategory", | ||
"value", "ADMIN" | ||
))); | ||
|
||
assertTrue(dmnDecisionTableResult.getResultList().contains(Map.of( | ||
"name", "roleCategory", | ||
"value", "CTSC" | ||
))); | ||
|
||
assertTrue(dmnDecisionTableResult.getResultList().contains(Map.of( | ||
"name", "description", | ||
"value", "[Review Exception Record Documents](/cases/case-details/${[CASE_REFERENCE]}" | ||
+ "/trigger/attachToExistingCase/attachToExistingCase1)" | ||
))); | ||
} | ||
} |
Oops, something went wrong.