Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DTSCCI-1355: fix npe on defendent response cui #5932

Merged
merged 2 commits into from
Dec 16, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,9 @@ public boolean shouldRecordScenario(CaseData caseData) {

@Override
public String getScenario(CaseData caseData) {

if (caseData.getRespondent1ClaimResponseTypeForSpec() == null) {
return null;
}
return switch (caseData.getRespondent1ClaimResponseTypeForSpec()) {
case FULL_DEFENCE -> getFullDefenceScenario(caseData);
case FULL_ADMISSION -> getFullAdmissionScenario(caseData);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
import static org.mockito.ArgumentMatchers.anyString;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.verifyNoInteractions;
import static org.mockito.Mockito.when;
import static uk.gov.hmcts.reform.civil.callback.CallbackType.ABOUT_TO_SUBMIT;
import static uk.gov.hmcts.reform.civil.callback.CaseEvent.CREATE_CLAIMANT_DASHBOARD_NOTIFICATION_FOR_DEFENDANT_RESPONSE;
Expand All @@ -54,13 +55,13 @@
import static uk.gov.hmcts.reform.civil.handler.callback.camunda.dashboardnotifications.DashboardScenarios.SCENARIO_AAA6_DEFENDANT_FULL_ADMIT_PAY_IMMEDIATELY_CLAIMANT;
import static uk.gov.hmcts.reform.civil.handler.callback.camunda.dashboardnotifications.DashboardScenarios.SCENARIO_AAA6_DEFENDANT_FULL_OR_PART_ADMIT_PAY_SET_DATE_CLAIMANT;
import static uk.gov.hmcts.reform.civil.handler.callback.camunda.dashboardnotifications.DashboardScenarios.SCENARIO_AAA6_DEFENDANT_FULL_OR_PART_ADMIT_PAY_SET_DATE_ORG_CLAIMANT;
import static uk.gov.hmcts.reform.civil.handler.callback.camunda.dashboardnotifications.DashboardScenarios.SCENARIO_AAA6_DEFENDANT_RESPONSE_FULL_DEFENCE_FULL_DISPUTE_CLAIMANT_CARM;
import static uk.gov.hmcts.reform.civil.handler.callback.camunda.dashboardnotifications.DashboardScenarios.SCENARIO_AAA6_DEFENDANT_RESPONSE_FULL_DEFENCE_FULL_DISPUTE_MEDIATION_CLAIMANT;
import static uk.gov.hmcts.reform.civil.handler.callback.camunda.dashboardnotifications.DashboardScenarios.SCENARIO_AAA6_DEFENDANT_RESPONSE_FULLDISPUTE_MULTI_INT_FAST_CLAIMANT;
import static uk.gov.hmcts.reform.civil.handler.callback.camunda.dashboardnotifications.DashboardScenarios.SCENARIO_AAA6_DEFENDANT_RESPONSE_FULL_DEFENCE_ALREADY_PAID_CLAIMANT;
import static uk.gov.hmcts.reform.civil.handler.callback.camunda.dashboardnotifications.DashboardScenarios.SCENARIO_AAA6_DEFENDANT_RESPONSE_FULL_DEFENCE_FULL_DISPUTE_CLAIMANT_CARM;
import static uk.gov.hmcts.reform.civil.handler.callback.camunda.dashboardnotifications.DashboardScenarios.SCENARIO_AAA6_DEFENDANT_RESPONSE_FULL_DEFENCE_FULL_DISPUTE_MEDIATION_CLAIMANT;

@ExtendWith(MockitoExtension.class)
public class DefendantResponseClaimantNotificationHandlerTest extends BaseCallbackHandlerTest {
class DefendantResponseClaimantNotificationHandlerTest extends BaseCallbackHandlerTest {

@InjectMocks
private DefendantResponseClaimantNotificationHandler handler;
Expand Down Expand Up @@ -155,7 +156,7 @@ void configureDashboardNotificationsForDefendantResponseForFullAdmitPayByDate(En
CaseData caseData = CaseDataBuilder.builder().atStateRespondentFullAdmissionSpec().build()
.toBuilder()
.legacyCaseReference("reference")
.ccdCaseReference(Long.valueOf(23055L))
.ccdCaseReference(23055L)
.applicant1Represented(YesOrNo.NO)
.respondent1(Party.builder()
.type(Party.Type.valueOf(partyType.name())).build())
Expand Down Expand Up @@ -192,7 +193,7 @@ void configureDashboardNotificationsForDefendantResponseForFullAdmitImmediatelyC
CaseData caseData = CaseDataBuilder.builder().atStateRespondentFullAdmissionSpec().build()
.toBuilder()
.legacyCaseReference("reference")
.ccdCaseReference(Long.valueOf(1234L))
.ccdCaseReference(1234L)
.applicant1Represented(YesOrNo.NO)
.respondToClaimAdmitPartLRspec(RespondToClaimAdmitPartLRspec
.builder()
Expand Down Expand Up @@ -486,7 +487,7 @@ void configureDashboardNotificationsForDefendantResponseFullDefenceDisputeAllCla
CaseData caseData = CaseDataBuilder.builder().atStateRespondentFullDefenceSpec().build()
.toBuilder()
.legacyCaseReference("reference")
.ccdCaseReference(Long.valueOf(1234L))
.ccdCaseReference(1234L)
.applicant1Represented(YesOrNo.NO)
.respondent1(Party.builder().type(Party.Type.INDIVIDUAL).build())
.respondToClaimAdmitPartLRspec(RespondToClaimAdmitPartLRspec
Expand Down Expand Up @@ -514,4 +515,30 @@ void configureDashboardNotificationsForDefendantResponseFullDefenceDisputeAllCla
ScenarioRequestParams.builder().params(params).build()
);
}

@Test
void willNotConfigureDashboardNotificationsForDefendantResponseWhenRespondent1ClaimResponseTypeForSpecIsNull() {
//given
LocalDate paymentDate = OffsetDateTime.now().toLocalDate().minusDays(5);
CaseData caseData = CaseDataBuilder.builder().atStateRespondentFullDefenceSpec().build()
.toBuilder()
.legacyCaseReference("reference")
.ccdCaseReference(12345673L)
.applicant1Represented(YesOrNo.NO)
.responseClaimTrack(SMALL_CLAIM.name())
.respondToClaim(RespondToClaim.builder()
.howMuchWasPaid(new BigDecimal(1000))
.whenWasThisAmountPaid(paymentDate)
.build())
.totalClaimAmount(new BigDecimal(1500))
.build();

CallbackParams callbackParams = CallbackParamsBuilder.builder()
.of(ABOUT_TO_SUBMIT, caseData)
.build();
//when
handler.handle(callbackParams);
//then
verifyNoInteractions(dashboardApiClient);
}
}
Loading