Skip to content

Commit

Permalink
Added Unit Test cases and manage permission for this task as it has t…
Browse files Browse the repository at this point in the history
…o be closed manually
  • Loading branch information
sathishkannan-hmcts committed Sep 4, 2024
1 parent b47bcb8 commit e4c8693
Show file tree
Hide file tree
Showing 4 changed files with 128 additions and 10 deletions.
66 changes: 63 additions & 3 deletions src/main/resources/wa-task-permissions-privatelaw-prlapps.dmn
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<definitions xmlns="https://www.omg.org/spec/DMN/20191111/MODEL/" xmlns:dmndi="https://www.omg.org/spec/DMN/20191111/DMNDI/" xmlns:dc="http://www.omg.org/spec/DMN/20180521/DC/" xmlns:biodi="http://bpmn.io/schema/dmn/biodi/2.0" xmlns:camunda="http://camunda.org/schema/1.0/dmn" id="wa-permissions-definition" name="DRD" namespace="http://camunda.org/schema/1.0/dmn" exporter="Camunda Modeler" exporterVersion="5.11.0">
<definitions xmlns="https://www.omg.org/spec/DMN/20191111/MODEL/" xmlns:dmndi="https://www.omg.org/spec/DMN/20191111/DMNDI/" xmlns:dc="http://www.omg.org/spec/DMN/20180521/DC/" xmlns:biodi="http://bpmn.io/schema/dmn/biodi/2.0" xmlns:camunda="http://camunda.org/schema/1.0/dmn" id="wa-permissions-definition" name="DRD" namespace="http://camunda.org/schema/1.0/dmn" exporter="Camunda Modeler" exporterVersion="5.1.0">
<decision id="wa-task-permissions-privatelaw-prlapps" name="Private Law Permissions DMN">
<decisionTable id="DecisionTable_1pr5oic" hitPolicy="RULE ORDER">
<input id="InputClause_12crj6e" label="Task Type" biodi:width="578" camunda:inputVariable="taskType">
Expand Down Expand Up @@ -479,7 +479,7 @@
<rule id="DecisionRule_1v7zc7t">
<description>Admin task permissions</description>
<inputEntry id="UnaryTests_10rpp7x">
<text>"serviceOfApplicationFL401","adminServeOrderFL401","recreateApplicationPack","appStatementOfServiceBySol","appStatementOfServiceByLiP","appStatementOfServiceByBailiff","arrangeBailiffSOA","appStatementOfServiceByAdmin","completefl416AndServe","listOnNoticeHearingFL401","listWithoutNoticeHearingFL401"</text>
<text>"serviceOfApplicationFL401","adminServeOrderFL401","recreateApplicationPack","appStatementOfServiceBySol","appStatementOfServiceByLiP","appStatementOfServiceByBailiff","arrangeBailiffSOA","appStatementOfServiceByAdmin","completefl416AndServe"</text>
</inputEntry>
<inputEntry id="UnaryTests_1ytal4l">
<text></text>
Expand All @@ -506,6 +506,36 @@
<text>false</text>
</outputEntry>
</rule>
<rule id="DecisionRule_1gza1bc">
<description>Admin task permissions</description>
<inputEntry id="UnaryTests_1byfxzl">
<text>"listOnNoticeHearingFL401","listWithoutNoticeHearingFL401"</text>
</inputEntry>
<inputEntry id="UnaryTests_0r24s7c">
<text></text>
</inputEntry>
<outputEntry id="LiteralExpression_1htbtgh">
<text></text>
</outputEntry>
<outputEntry id="LiteralExpression_1wcsc6m">
<text>"hearing-centre-admin"</text>
</outputEntry>
<outputEntry id="LiteralExpression_14nya2j">
<text>"Read,Manage,Own,UnclaimAssign,Claim,Unclaim,UnassignClaim"</text>
</outputEntry>
<outputEntry id="LiteralExpression_0hsp0ap">
<text>"ADMIN"</text>
</outputEntry>
<outputEntry id="LiteralExpression_1kklmjv">
<text>"SKILL:ABA5:HEARINGMANAGEMENTFL401"</text>
</outputEntry>
<outputEntry id="LiteralExpression_0iz12vb">
<text></text>
</outputEntry>
<outputEntry id="LiteralExpression_07bbxsp">
<text>false</text>
</outputEntry>
</rule>
<rule id="DecisionRule_1wrkkzl">
<inputEntry id="UnaryTests_18p5ocz">
<text>"reviewCorrespondenceFL401","reviewDocumentsForSolAndCafcassFL401"</text>
Expand Down Expand Up @@ -629,7 +659,7 @@
<rule id="DecisionRule_1evorlb">
<description>CTSC task permissions</description>
<inputEntry id="UnaryTests_1k15vbg">
<text>"sendToGateKeeperC100","sendToGateKeeperResubmittedC100","removeLegalRepresentativeC100","replyToMessageForCourtAdminC100","reviewRaRequestsC100","reviewInactiveRaRequestsC100","listWithoutNoticeHearingC100","reviewAdditionalApplication","reviewLangAndSmReq"</text>
<text>"sendToGateKeeperC100","sendToGateKeeperResubmittedC100","removeLegalRepresentativeC100","replyToMessageForCourtAdminC100","reviewRaRequestsC100","reviewInactiveRaRequestsC100","reviewAdditionalApplication","reviewLangAndSmReq"</text>
</inputEntry>
<inputEntry id="UnaryTests_12k147l">
<text></text>
Expand All @@ -656,6 +686,36 @@
<text>false</text>
</outputEntry>
</rule>
<rule id="DecisionRule_01jmsgx">
<description>CTSC task permissions</description>
<inputEntry id="UnaryTests_1i9om6y">
<text>"listWithoutNoticeHearingC100"</text>
</inputEntry>
<inputEntry id="UnaryTests_0lleykv">
<text></text>
</inputEntry>
<outputEntry id="LiteralExpression_0sjlhej">
<text></text>
</outputEntry>
<outputEntry id="LiteralExpression_0kado4p">
<text>"hearing-centre-admin"</text>
</outputEntry>
<outputEntry id="LiteralExpression_1e0oc54">
<text>"Read,Manage,Own,UnclaimAssign,Claim,Unclaim,UnassignClaim"</text>
</outputEntry>
<outputEntry id="LiteralExpression_1hp8nbt">
<text>"ADMIN"</text>
</outputEntry>
<outputEntry id="LiteralExpression_0y0fth3">
<text>"SKILL:ABA5:HEARINGMANAGEMENTC100"</text>
</outputEntry>
<outputEntry id="LiteralExpression_09vnc97">
<text></text>
</outputEntry>
<outputEntry id="LiteralExpression_1i452wm">
<text>false</text>
</outputEntry>
</rule>
<rule id="DecisionRule_079udd1">
<description>CTSC task permissions</description>
<inputEntry id="UnaryTests_0ahkyod">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ void if_this_test_fails_needs_updating_with_your_changes() {
DmnDecisionTableImpl logic = (DmnDecisionTableImpl) decision.getDecisionLogic();
assertThat(logic.getInputs().size(), is(2));
assertThat(logic.getOutputs().size(), is(3));
assertThat(logic.getRules().size(), is(86));
assertThat(logic.getRules().size(), is(87));
}

@Test
Expand Down Expand Up @@ -187,7 +187,7 @@ void when_caseData_then_return_expected_dueDateFields() {
"updateHearingActualsC100","updateHearingActualsFL401","requestSolicitorOrderC100",
"requestSolicitorOrderFL401","confidentialCheckSOA","recreateApplicationPack",
"replyToMessageForCourtAdminFL401","replyToMessageForCourtAdminC100","replyToMessageForLA",
"completefl416AndServe","listWithoutNoticeHearingC100","listOnNoticeHearingFL401","reviewLangAndSmReq"
"completefl416AndServe","listWithoutNoticeHearingC100","listOnNoticeHearingFL401","reviewLangAndSmReq","listWithoutNoticeHearingFL401"
})
void when_given_task_type_then_return_dueDateIntervalDays_and_validate_description(String taskType) {
VariableMap inputVariables = new VariableMapImpl();
Expand Down Expand Up @@ -610,7 +610,7 @@ void when_given_task_type_then_return_nextHearingDateFields_and_validate_descrip
"serviceOfApplicationFL401","adminServeOrderFL401","updateHearingActualsFL401",
"requestSolicitorOrderFL401", "reviewCorrespondenceFL401","produceHearingBundleFL401",
"removeLegalRepresentativeFL401", "replyToMessageForCourtAdminFL401",
"reviewDocumentsForSolAndCafcassFL401","listWithoutNoticeHearingC100","listOnNoticeHearingFL401"
"reviewDocumentsForSolAndCafcassFL401","listWithoutNoticeHearingC100","listOnNoticeHearingFL401","listWithoutNoticeHearingFL401"
})
void when_given_task_type_then_return_majorPriorityForValue1000_and_validate_description(String taskType) {
VariableMap inputVariables = new VariableMapImpl();
Expand Down Expand Up @@ -1049,7 +1049,7 @@ void when_given_task_type_then_return_titleForAwpWaTaskName_and_validate_descrip
"reviewInactiveRaRequestsFL401","appStatementOfServiceBySol",
"appStatementOfServiceByLiP","appStatementOfServiceByBailiff","arrangeBailiffSOA",
"appStatementOfServiceByAdmin","completefl416AndServe","listWithoutNoticeHearingC100",
"listOnNoticeHearingFL401","reviewAdditionalApplication","reviewLangAndSmReq"
"listOnNoticeHearingFL401","reviewAdditionalApplication","reviewLangAndSmReq","listWithoutNoticeHearingFL401"
})
void when_given_task_type_then_return_workType_and_validate_description(String taskType) {
VariableMap inputVariables = new VariableMapImpl();
Expand Down Expand Up @@ -1275,7 +1275,7 @@ void when_given_task_type_then_return_roleCategory_and_validate_description(
"completefl416AndServe","removeLegalRepresentativeC100","replyToMessageForCourtAdminC100",
"replyToMessageForCourtAdminFL401","reviewRaRequestsC100","reviewInactiveRaRequestsC100",
"listWithoutNoticeHearingC100","listOnNoticeHearingFL401","reviewAdditionalApplication",
"reviewLangAndSmReq"
"reviewLangAndSmReq","listWithoutNoticeHearingFL401"
})
void when_given_task_type_then_return_roleCategoryForValueAdmin_and_validate_description(
String taskType) {
Expand Down Expand Up @@ -1627,6 +1627,7 @@ private static String getDescriptionBasedOnTaskType(String taskType) {

case "listWithoutNoticeHearingC100":
case "listOnNoticeHearingFL401":
case "listWithoutNoticeHearingFL401":
return "";

case "reviewAdditionalApplication":
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ void if_this_test_fails_needs_updating_with_your_changes() {
DmnDecisionTableImpl logic = (DmnDecisionTableImpl) decision.getDecisionLogic();
assertThat(logic.getInputs().size(), is(20));
assertThat(logic.getOutputs().size(), is(4));
assertThat(logic.getRules().size(), is(102));
assertThat(logic.getRules().size(), is(103));
}

static Stream<Arguments> scenarioProvider() {
Expand Down Expand Up @@ -1003,6 +1003,18 @@ static Stream<Arguments> scenarioProvider() {
)
)
),
Arguments.of(
"listWithoutNotice",
null,
null,
List.of(
Map.of(
"name", "List without notice hearing (see case notes)",
"processCategories", "listWithoutNoticeHearingFL401",
"taskId", "listWithoutNoticeHearingFL401"
)
)
),
Arguments.of(
"awpPaymentSuccessCallback",
null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -816,12 +816,57 @@ void evaluate_task_admin_statementOfService(String taskType) {
)));
}

@ParameterizedTest
@CsvSource(value = {
"listWithoutNoticeHearingC100"
})
void evaluate_task_admin_listWithoutNoticeC100(String taskType) {
VariableMap inputVariables = new VariableMapImpl();
inputVariables.putValue("taskAttributes", Map.of("taskType", taskType));

DmnDecisionTableResult dmnDecisionTableResult = evaluateDmnTable(inputVariables);

MatcherAssert.assertThat(dmnDecisionTableResult.getResultList(), is(List.of(
taskSupervisor,
Map.of(
"autoAssignable", false,
"name", "hearing-centre-admin",
"roleCategory", "ADMIN",
"value", "Read,Manage,Own,UnclaimAssign,Claim,Unclaim,UnassignClaim",
"authorisations", "SKILL:ABA5:HEARINGMANAGEMENTC100"
)

)));
}
@ParameterizedTest
@CsvSource(value = {
"listOnNoticeHearingFL401","listWithoutNoticeHearingFL401"
})
void evaluate_task_admin_listOnNoticeWithoutNoticeFL401(String taskType) {
VariableMap inputVariables = new VariableMapImpl();
inputVariables.putValue("taskAttributes", Map.of("taskType", taskType));

DmnDecisionTableResult dmnDecisionTableResult = evaluateDmnTable(inputVariables);

MatcherAssert.assertThat(dmnDecisionTableResult.getResultList(), is(List.of(
taskSupervisor,
Map.of(
"autoAssignable", false,
"name", "hearing-centre-admin",
"roleCategory", "ADMIN",
"value", "Read,Manage,Own,UnclaimAssign,Claim,Unclaim,UnassignClaim",
"authorisations", "SKILL:ABA5:HEARINGMANAGEMENTFL401"
)

)));
}

@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(7));
assertThat(logic.getRules().size(), is(26));
assertThat(logic.getRules().size(), is(28));
}
}

0 comments on commit e4c8693

Please sign in to comment.