diff --git a/src/main/java/uk/gov/hmcts/reform/iacaseapi/domain/entities/FtpaResidentJudgeDecisionOutcomeType.java b/src/main/java/uk/gov/hmcts/reform/iacaseapi/domain/entities/FtpaResidentJudgeDecisionOutcomeType.java index 3c93bf56fd..f187595ff6 100644 --- a/src/main/java/uk/gov/hmcts/reform/iacaseapi/domain/entities/FtpaResidentJudgeDecisionOutcomeType.java +++ b/src/main/java/uk/gov/hmcts/reform/iacaseapi/domain/entities/FtpaResidentJudgeDecisionOutcomeType.java @@ -3,11 +3,14 @@ import com.fasterxml.jackson.annotation.JsonValue; public enum FtpaResidentJudgeDecisionOutcomeType { - PARTIALLY_GRANTED("partiallyGranted"), + GRANTED("granted"), + PARTIALLY_GRANTED("partiallyGranted"), REFUSED("refused"), + APPLICATION_NOT_ADMITTED("notAdmitted"), + WITHDRAWN("withdrawn"), REHEARD_RULE35("reheardRule35"), - REHEARD_RULE32("reheardRule32"), + REMADE_RULE31("remadeRule31"), REMADE_RULE32("remadeRule32"); @JsonValue diff --git a/src/main/java/uk/gov/hmcts/reform/iacaseapi/domain/handlers/presubmit/FtpaDecisionMidEvent.java b/src/main/java/uk/gov/hmcts/reform/iacaseapi/domain/handlers/presubmit/FtpaDecisionMidEvent.java index 91d50dfcaa..b0ad3bdee0 100644 --- a/src/main/java/uk/gov/hmcts/reform/iacaseapi/domain/handlers/presubmit/FtpaDecisionMidEvent.java +++ b/src/main/java/uk/gov/hmcts/reform/iacaseapi/domain/handlers/presubmit/FtpaDecisionMidEvent.java @@ -6,6 +6,7 @@ import static uk.gov.hmcts.reform.iacaseapi.domain.entities.Parties.RESPONDENT; import java.util.Optional; + import org.springframework.stereotype.Component; import uk.gov.hmcts.reform.iacaseapi.domain.entities.*; import uk.gov.hmcts.reform.iacaseapi.domain.entities.ccd.Event; @@ -28,7 +29,7 @@ public boolean canHandle( requireNonNull(callback, "callback must not be null"); return callbackStage == PreSubmitCallbackStage.MID_EVENT - && (callback.getEvent() == Event.LEADERSHIP_JUDGE_FTPA_DECISION || callback.getEvent() == Event.RESIDENT_JUDGE_FTPA_DECISION); + && (callback.getEvent() == Event.LEADERSHIP_JUDGE_FTPA_DECISION || callback.getEvent() == Event.RESIDENT_JUDGE_FTPA_DECISION); } public PreSubmitCallbackResponse handle( @@ -49,13 +50,12 @@ public PreSubmitCallbackResponse handle( .orElseThrow(() -> new IllegalStateException("FtpaApplicantType is not present")); Optional ftpaRjDecisionOutcomeType = asylumCase.read(ftpaApplicantType.equals(APPELLANT.toString()) - ? FTPA_APPELLANT_RJ_DECISION_OUTCOME_TYPE - : FTPA_RESPONDENT_RJ_DECISION_OUTCOME_TYPE, String.class); + ? FTPA_APPELLANT_RJ_DECISION_OUTCOME_TYPE + : FTPA_RESPONDENT_RJ_DECISION_OUTCOME_TYPE, String.class); if (!HandlerUtils.isRepJourney(asylumCase) && ftpaRjDecisionOutcomeType.isPresent()) { String ftpaRjDecisionOutcomeTypeValue = ftpaRjDecisionOutcomeType.get(); if (ftpaRjDecisionOutcomeTypeValue.equals(FtpaResidentJudgeDecisionOutcomeType.REHEARD_RULE35.toString()) - || ftpaRjDecisionOutcomeTypeValue.equals(FtpaResidentJudgeDecisionOutcomeType.REHEARD_RULE32.toString()) || ftpaRjDecisionOutcomeTypeValue.equals(FtpaResidentJudgeDecisionOutcomeType.REMADE_RULE32.toString())) { PreSubmitCallbackResponse response = new PreSubmitCallbackResponse<>(asylumCase); response.addError("For Legal Representative Journey Only"); @@ -75,7 +75,7 @@ public PreSubmitCallbackResponse handle( asylumCasePreSubmitCallbackResponse.addError("You've made an invalid request. There is no appellant FTPA application to record the decision."); return asylumCasePreSubmitCallbackResponse; } else if ((callback.getEvent() == Event.LEADERSHIP_JUDGE_FTPA_DECISION || callback.getEvent() == Event.RESIDENT_JUDGE_FTPA_DECISION) - && ftpaApplicantType.equals(RESPONDENT.toString()) && !ftpaSubmitted.isPresent()) { + && ftpaApplicantType.equals(RESPONDENT.toString()) && !ftpaSubmitted.isPresent()) { asylumCasePreSubmitCallbackResponse.addError("You've made an invalid request. There is no respondent FTPA application to record the decision."); return asylumCasePreSubmitCallbackResponse; @@ -93,18 +93,12 @@ public PreSubmitCallbackResponse handle( private void setResidentJudgeDecisionPagesVisibility(AsylumCase asylumCase) { - final YesOrNo isFtpaAppellantNoticeOfDecisionSetAside = asylumCase.read(IS_FTPA_APPELLANT_NOTICE_OF_DECISION_SET_ASIDE, YesOrNo.class).orElse(YesOrNo.NO); final String ftpaAppellantRjDecisionOutcomeType = asylumCase.read(FTPA_APPELLANT_RJ_DECISION_OUTCOME_TYPE, String.class).orElse(""); - final YesOrNo isFtpaRespondentNoticeOfDecisionSetAside = asylumCase.read(IS_FTPA_RESPONDENT_NOTICE_OF_DECISION_SET_ASIDE, YesOrNo.class).orElse(YesOrNo.NO); final String ftpaRespondentRjDecisionOutcomeType = asylumCase.read(FTPA_RESPONDENT_RJ_DECISION_OUTCOME_TYPE, String.class).orElse(""); - // Page 3 - setNoticeOfDecisionSetAsideVisibility(asylumCase, ftpaAppellantRjDecisionOutcomeType, ftpaRespondentRjDecisionOutcomeType); - // Page 4 - setDecisionObjectionsPageVisibility(asylumCase, isFtpaAppellantNoticeOfDecisionSetAside, ftpaAppellantRjDecisionOutcomeType, - isFtpaRespondentNoticeOfDecisionSetAside, ftpaRespondentRjDecisionOutcomeType); + setNoticeOfDecisionSetAsideVisibility(asylumCase, ftpaAppellantRjDecisionOutcomeType, ftpaRespondentRjDecisionOutcomeType); // Page 5 setDecisionReasonsNotesVisibility(asylumCase, ftpaAppellantRjDecisionOutcomeType, ftpaRespondentRjDecisionOutcomeType); @@ -115,17 +109,13 @@ private void setResidentJudgeDecisionPagesVisibility(AsylumCase asylumCase) { private void setDecisionListingVisibility(AsylumCase asylumCase, String ftpaAppellantRjDecisionOutcomeType, String ftpaRespondentRjDecisionOutcomeType) { - if (ftpaAppellantRjDecisionOutcomeType.equals(FtpaResidentJudgeDecisionOutcomeType.REHEARD_RULE35.toString()) - || ftpaAppellantRjDecisionOutcomeType.equals(FtpaResidentJudgeDecisionOutcomeType.REHEARD_RULE32.toString())) { - + if (ftpaAppellantRjDecisionOutcomeType.equals(FtpaResidentJudgeDecisionOutcomeType.REHEARD_RULE35.toString())) { asylumCase.write(AsylumCaseFieldDefinition.FTPA_APPELLANT_DECISION_LISTING_VISIBLE, YesOrNo.YES); } else { asylumCase.write(AsylumCaseFieldDefinition.FTPA_APPELLANT_DECISION_LISTING_VISIBLE, YesOrNo.NO); } - if (ftpaRespondentRjDecisionOutcomeType.equals(FtpaResidentJudgeDecisionOutcomeType.REHEARD_RULE35.toString()) - || ftpaRespondentRjDecisionOutcomeType.equals(FtpaResidentJudgeDecisionOutcomeType.REHEARD_RULE32.toString())) { - + if (ftpaRespondentRjDecisionOutcomeType.equals(FtpaResidentJudgeDecisionOutcomeType.REHEARD_RULE35.toString())) { asylumCase.write(AsylumCaseFieldDefinition.FTPA_RESPONDENT_DECISION_LISTING_VISIBLE, YesOrNo.YES); } else { asylumCase.write(AsylumCaseFieldDefinition.FTPA_RESPONDENT_DECISION_LISTING_VISIBLE, YesOrNo.NO); @@ -173,31 +163,6 @@ private void setFtpaDecisionReasonsNotesVisibility(AsylumCase asylumCase) { } } - private void setDecisionObjectionsPageVisibility( - final AsylumCase asylumCase, - final YesOrNo isFtpaAppellantNoticeOfDecisionSetAside, - final String ftpaAppellantRjDecisionOutcomeType, - final YesOrNo isFtpaRespondentNoticeOfDecisionSetAside, - final String ftpaRespondentRjDecisionOutcomeType - ) { - - if (isFtpaAppellantNoticeOfDecisionSetAside.equals(YesOrNo.YES) - || ftpaAppellantRjDecisionOutcomeType.equals(FtpaResidentJudgeDecisionOutcomeType.REHEARD_RULE35.toString())) { - - asylumCase.write(AsylumCaseFieldDefinition.FTPA_APPELLANT_DECISION_OBJECTIONS_VISIBLE, YesOrNo.YES); - } else { - asylumCase.write(AsylumCaseFieldDefinition.FTPA_APPELLANT_DECISION_OBJECTIONS_VISIBLE, YesOrNo.NO); - } - - if (isFtpaRespondentNoticeOfDecisionSetAside.equals(YesOrNo.YES) - || ftpaRespondentRjDecisionOutcomeType.equals(FtpaResidentJudgeDecisionOutcomeType.REHEARD_RULE35.toString())) { - - asylumCase.write(AsylumCaseFieldDefinition.FTPA_RESPONDENT_DECISION_OBJECTIONS_VISIBLE, YesOrNo.YES); - } else { - asylumCase.write(AsylumCaseFieldDefinition.FTPA_RESPONDENT_DECISION_OBJECTIONS_VISIBLE, YesOrNo.NO); - } - } - private void setNoticeOfDecisionSetAsideVisibility( final AsylumCase asylumCase, final String ftpaAppellantRjDecisionOutcomeType, @@ -206,7 +171,8 @@ private void setNoticeOfDecisionSetAsideVisibility( if (ftpaAppellantRjDecisionOutcomeType.equals(FtpaResidentJudgeDecisionOutcomeType.GRANTED.toString()) || ftpaAppellantRjDecisionOutcomeType.equals(FtpaResidentJudgeDecisionOutcomeType.PARTIALLY_GRANTED.toString()) - || ftpaAppellantRjDecisionOutcomeType.equals(FtpaResidentJudgeDecisionOutcomeType.REFUSED.toString())) { + || ftpaAppellantRjDecisionOutcomeType.equals(FtpaResidentJudgeDecisionOutcomeType.REFUSED.toString()) + || ftpaAppellantRjDecisionOutcomeType.equals(FtpaResidentJudgeDecisionOutcomeType.APPLICATION_NOT_ADMITTED.toString())) { asylumCase.write(AsylumCaseFieldDefinition.FTPA_APPELLANT_NOTICE_OF_DECISION_SET_ASIDE_VISIBLE, YesOrNo.YES); } else { @@ -215,7 +181,8 @@ private void setNoticeOfDecisionSetAsideVisibility( if (ftpaRespondentRjDecisionOutcomeType.equals(FtpaResidentJudgeDecisionOutcomeType.GRANTED.toString()) || ftpaRespondentRjDecisionOutcomeType.equals(FtpaResidentJudgeDecisionOutcomeType.PARTIALLY_GRANTED.toString()) - || ftpaRespondentRjDecisionOutcomeType.equals(FtpaResidentJudgeDecisionOutcomeType.REFUSED.toString())) { + || ftpaRespondentRjDecisionOutcomeType.equals(FtpaResidentJudgeDecisionOutcomeType.REFUSED.toString()) + || ftpaRespondentRjDecisionOutcomeType.equals(FtpaResidentJudgeDecisionOutcomeType.APPLICATION_NOT_ADMITTED.toString())) { asylumCase.write(AsylumCaseFieldDefinition.FTPA_RESPONDENT_NOTICE_OF_DECISION_SET_ASIDE_VISIBLE, YesOrNo.YES); } else { diff --git a/src/main/java/uk/gov/hmcts/reform/iacaseapi/domain/handlers/presubmit/UpperTribunalBundlePreparer.java b/src/main/java/uk/gov/hmcts/reform/iacaseapi/domain/handlers/presubmit/UpperTribunalBundlePreparer.java index 3059e5ac90..6c000a31e9 100644 --- a/src/main/java/uk/gov/hmcts/reform/iacaseapi/domain/handlers/presubmit/UpperTribunalBundlePreparer.java +++ b/src/main/java/uk/gov/hmcts/reform/iacaseapi/domain/handlers/presubmit/UpperTribunalBundlePreparer.java @@ -45,14 +45,12 @@ public PreSubmitCallbackResponse handle(PreSubmitCallbackStage callb boolean setAsideRespondentDecisionExists = ftpaRespondentRjDecisionOutcomeType.isPresent() - && (ftpaRespondentRjDecisionOutcomeType.get().equals(FtpaResidentJudgeDecisionOutcomeType.REHEARD_RULE32.toString()) - || ftpaRespondentRjDecisionOutcomeType.get().equals(FtpaResidentJudgeDecisionOutcomeType.REHEARD_RULE35.toString()) + && (ftpaRespondentRjDecisionOutcomeType.get().equals(FtpaResidentJudgeDecisionOutcomeType.REHEARD_RULE35.toString()) || ftpaRespondentRjDecisionOutcomeType.get().equals(FtpaResidentJudgeDecisionOutcomeType.REMADE_RULE32.toString())); boolean setAsideAppellantDecisionExists = ftpaAppellantRjDecisionOutcomeType.isPresent() - && (ftpaAppellantRjDecisionOutcomeType.get().equals(FtpaResidentJudgeDecisionOutcomeType.REHEARD_RULE32.toString()) - || ftpaAppellantRjDecisionOutcomeType.get().equals(FtpaResidentJudgeDecisionOutcomeType.REHEARD_RULE35.toString()) + && (ftpaAppellantRjDecisionOutcomeType.get().equals(FtpaResidentJudgeDecisionOutcomeType.REHEARD_RULE35.toString()) || ftpaAppellantRjDecisionOutcomeType.get().equals(FtpaResidentJudgeDecisionOutcomeType.REMADE_RULE32.toString())); if (setAsideRespondentDecisionExists || setAsideAppellantDecisionExists) { diff --git a/src/test/java/uk/gov/hmcts/reform/iacaseapi/domain/handlers/presubmit/FtpaDecisionMidEventTest.java b/src/test/java/uk/gov/hmcts/reform/iacaseapi/domain/handlers/presubmit/FtpaDecisionMidEventTest.java index 67feb33e5b..710b63cb36 100644 --- a/src/test/java/uk/gov/hmcts/reform/iacaseapi/domain/handlers/presubmit/FtpaDecisionMidEventTest.java +++ b/src/test/java/uk/gov/hmcts/reform/iacaseapi/domain/handlers/presubmit/FtpaDecisionMidEventTest.java @@ -10,7 +10,6 @@ import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; import static uk.gov.hmcts.reform.iacaseapi.domain.entities.AsylumCaseFieldDefinition.FTPA_APPELLANT_DECISION_LISTING_VISIBLE; -import static uk.gov.hmcts.reform.iacaseapi.domain.entities.AsylumCaseFieldDefinition.FTPA_APPELLANT_DECISION_OBJECTIONS_VISIBLE; import static uk.gov.hmcts.reform.iacaseapi.domain.entities.AsylumCaseFieldDefinition.FTPA_APPELLANT_DECISION_OUTCOME_TYPE; import static uk.gov.hmcts.reform.iacaseapi.domain.entities.AsylumCaseFieldDefinition.FTPA_APPELLANT_DECISION_REASONS_NOTES_VISIBLE; import static uk.gov.hmcts.reform.iacaseapi.domain.entities.AsylumCaseFieldDefinition.FTPA_APPELLANT_DECISION_REASONS_VISIBLE; @@ -19,15 +18,12 @@ import static uk.gov.hmcts.reform.iacaseapi.domain.entities.AsylumCaseFieldDefinition.FTPA_APPELLANT_SUBMITTED; import static uk.gov.hmcts.reform.iacaseapi.domain.entities.AsylumCaseFieldDefinition.FTPA_APPLICANT_TYPE; import static uk.gov.hmcts.reform.iacaseapi.domain.entities.AsylumCaseFieldDefinition.FTPA_RESPONDENT_DECISION_LISTING_VISIBLE; -import static uk.gov.hmcts.reform.iacaseapi.domain.entities.AsylumCaseFieldDefinition.FTPA_RESPONDENT_DECISION_OBJECTIONS_VISIBLE; import static uk.gov.hmcts.reform.iacaseapi.domain.entities.AsylumCaseFieldDefinition.FTPA_RESPONDENT_DECISION_OUTCOME_TYPE; import static uk.gov.hmcts.reform.iacaseapi.domain.entities.AsylumCaseFieldDefinition.FTPA_RESPONDENT_DECISION_REASONS_NOTES_VISIBLE; import static uk.gov.hmcts.reform.iacaseapi.domain.entities.AsylumCaseFieldDefinition.FTPA_RESPONDENT_DECISION_REASONS_VISIBLE; import static uk.gov.hmcts.reform.iacaseapi.domain.entities.AsylumCaseFieldDefinition.FTPA_RESPONDENT_NOTICE_OF_DECISION_SET_ASIDE_VISIBLE; import static uk.gov.hmcts.reform.iacaseapi.domain.entities.AsylumCaseFieldDefinition.FTPA_RESPONDENT_RJ_DECISION_OUTCOME_TYPE; import static uk.gov.hmcts.reform.iacaseapi.domain.entities.AsylumCaseFieldDefinition.FTPA_RESPONDENT_SUBMITTED; -import static uk.gov.hmcts.reform.iacaseapi.domain.entities.AsylumCaseFieldDefinition.IS_FTPA_APPELLANT_NOTICE_OF_DECISION_SET_ASIDE; -import static uk.gov.hmcts.reform.iacaseapi.domain.entities.AsylumCaseFieldDefinition.IS_FTPA_RESPONDENT_NOTICE_OF_DECISION_SET_ASIDE; import static uk.gov.hmcts.reform.iacaseapi.domain.entities.AsylumCaseFieldDefinition.JOURNEY_TYPE; import static uk.gov.hmcts.reform.iacaseapi.domain.entities.ccd.callback.PreSubmitCallbackStage.ABOUT_TO_START; import static uk.gov.hmcts.reform.iacaseapi.domain.entities.ccd.callback.PreSubmitCallbackStage.ABOUT_TO_SUBMIT; @@ -35,6 +31,7 @@ import java.util.Optional; import java.util.Set; + import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; @@ -292,36 +289,31 @@ void should_successfully_set_ftpa_respondent_decision_reasons_notes_visibility_w verify(asylumCase).write(FTPA_RESPONDENT_DECISION_REASONS_VISIBLE, YesOrNo.YES); } - @Test - void should_successfully_set_appellant_notice_of_decision_set_aside_visibility_when_granted() { - + @ParameterizedTest + @CsvSource({ + "APPELLANT, GRANTED", + "APPELLANT, PARTIALLY_GRANTED", + "APPELLANT, REFUSED", + "APPELLANT, APPLICATION_NOT_ADMITTED", + "RESPONDENT, GRANTED", + "RESPONDENT, PARTIALLY_GRANTED", + "RESPONDENT, REFUSED", + "RESPONDENT, APPLICATION_NOT_ADMITTED", + }) + void should_successfully_set_appellant_notice_of_decision_set_aside_visibility_when_different_statuses( + Parties party, + FtpaResidentJudgeDecisionOutcomeType selection + ) { when(callback.getEvent()).thenReturn(Event.RESIDENT_JUDGE_FTPA_DECISION); - when(asylumCase.read(FTPA_APPLICANT_TYPE, String.class)).thenReturn(Optional.of(Parties.APPELLANT.toString())); - when(asylumCase.read(FTPA_APPELLANT_SUBMITTED, String.class)).thenReturn(Optional.of(YesOrNo.YES.toString())); - - when(asylumCase.read(FTPA_APPELLANT_RJ_DECISION_OUTCOME_TYPE, String.class)) - .thenReturn(Optional.of(FtpaResidentJudgeDecisionOutcomeType.GRANTED.toString())); - - - PreSubmitCallbackResponse callbackResponse = - ftpaDecisionMidEvent.handle(MID_EVENT, callback); - - assertNotNull(callback); - assertEquals(asylumCase, callbackResponse.getData()); - final Set errors = callbackResponse.getErrors(); - assertThat(errors).isEmpty(); - verify(asylumCase).write(FTPA_APPELLANT_NOTICE_OF_DECISION_SET_ASIDE_VISIBLE, YesOrNo.YES); - } - - @Test - void should_successfully_set_appellant_notice_of_decision_set_aside_visibility_when_partially_granted() { + when(asylumCase.read(FTPA_APPLICANT_TYPE, String.class)).thenReturn(Optional.of(party.toString())); - when(callback.getEvent()).thenReturn(Event.RESIDENT_JUDGE_FTPA_DECISION); - when(asylumCase.read(FTPA_APPLICANT_TYPE, String.class)).thenReturn(Optional.of(Parties.APPELLANT.toString())); - when(asylumCase.read(FTPA_APPELLANT_SUBMITTED, String.class)).thenReturn(Optional.of(YesOrNo.YES.toString())); + when(asylumCase.read(party.equals(Parties.APPELLANT) ? + FTPA_APPELLANT_SUBMITTED : FTPA_RESPONDENT_SUBMITTED, String.class)) + .thenReturn(Optional.of(YesOrNo.YES.toString())); - when(asylumCase.read(FTPA_APPELLANT_RJ_DECISION_OUTCOME_TYPE, String.class)) - .thenReturn(Optional.of(FtpaResidentJudgeDecisionOutcomeType.PARTIALLY_GRANTED.toString())); + when(asylumCase.read(party.equals(Parties.APPELLANT) ? + FTPA_APPELLANT_RJ_DECISION_OUTCOME_TYPE : FTPA_RESPONDENT_RJ_DECISION_OUTCOME_TYPE, String.class)) + .thenReturn(Optional.of(selection.toString())); PreSubmitCallbackResponse callbackResponse = @@ -331,29 +323,11 @@ void should_successfully_set_appellant_notice_of_decision_set_aside_visibility_w assertEquals(asylumCase, callbackResponse.getData()); final Set errors = callbackResponse.getErrors(); assertThat(errors).isEmpty(); - verify(asylumCase).write(FTPA_APPELLANT_NOTICE_OF_DECISION_SET_ASIDE_VISIBLE, YesOrNo.YES); + verify(asylumCase).write(party.equals(Parties.APPELLANT) ? + FTPA_APPELLANT_NOTICE_OF_DECISION_SET_ASIDE_VISIBLE : + FTPA_RESPONDENT_NOTICE_OF_DECISION_SET_ASIDE_VISIBLE, YesOrNo.YES); } - @Test - void should_successfully_set_appellant_notice_of_decision_set_aside_visibility_when_refused() { - - when(callback.getEvent()).thenReturn(Event.RESIDENT_JUDGE_FTPA_DECISION); - when(asylumCase.read(FTPA_APPLICANT_TYPE, String.class)).thenReturn(Optional.of(Parties.APPELLANT.toString())); - when(asylumCase.read(FTPA_APPELLANT_SUBMITTED, String.class)).thenReturn(Optional.of(YesOrNo.YES.toString())); - - when(asylumCase.read(FTPA_APPELLANT_RJ_DECISION_OUTCOME_TYPE, String.class)) - .thenReturn(Optional.of(FtpaResidentJudgeDecisionOutcomeType.REFUSED.toString())); - - - PreSubmitCallbackResponse callbackResponse = - ftpaDecisionMidEvent.handle(MID_EVENT, callback); - - assertNotNull(callback); - assertEquals(asylumCase, callbackResponse.getData()); - final Set errors = callbackResponse.getErrors(); - assertThat(errors).isEmpty(); - verify(asylumCase).write(FTPA_APPELLANT_NOTICE_OF_DECISION_SET_ASIDE_VISIBLE, YesOrNo.YES); - } @Test void should_successfully_set_respondent_notice_of_decision_set_aside_visibility_when_granted() { @@ -419,90 +393,6 @@ void should_successfully_set_respondent_notice_of_decision_set_aside_visibility_ } - @Test - void should_successfully_set_appellant_decision_objections_page_visibility_when_set_aside_is_yes() { - - when(callback.getEvent()).thenReturn(Event.LEADERSHIP_JUDGE_FTPA_DECISION); - when(asylumCase.read(FTPA_APPLICANT_TYPE, String.class)).thenReturn(Optional.of(Parties.APPELLANT.toString())); - when(asylumCase.read(FTPA_APPELLANT_SUBMITTED, String.class)).thenReturn(Optional.of(YesOrNo.YES.toString())); - - when(asylumCase.read(IS_FTPA_APPELLANT_NOTICE_OF_DECISION_SET_ASIDE, YesOrNo.class)) - .thenReturn(Optional.of(YesOrNo.YES)); - - - PreSubmitCallbackResponse callbackResponse = - ftpaDecisionMidEvent.handle(MID_EVENT, callback); - - assertNotNull(callback); - assertEquals(asylumCase, callbackResponse.getData()); - final Set errors = callbackResponse.getErrors(); - assertThat(errors).isEmpty(); - verify(asylumCase).write(FTPA_APPELLANT_DECISION_OBJECTIONS_VISIBLE, YesOrNo.YES); - } - - @Test - void should_successfully_set_respondent_decision_objections_page_visibility_when_set_aside_is_yes() { - - when(callback.getEvent()).thenReturn(Event.LEADERSHIP_JUDGE_FTPA_DECISION); - when(asylumCase.read(FTPA_APPLICANT_TYPE, String.class)).thenReturn(Optional.of(Parties.RESPONDENT.toString())); - when(asylumCase.read(FTPA_RESPONDENT_SUBMITTED, String.class)).thenReturn(Optional.of(YesOrNo.YES.toString())); - - when(asylumCase.read(IS_FTPA_RESPONDENT_NOTICE_OF_DECISION_SET_ASIDE, YesOrNo.class)) - .thenReturn(Optional.of(YesOrNo.YES)); - - - PreSubmitCallbackResponse callbackResponse = - ftpaDecisionMidEvent.handle(MID_EVENT, callback); - - assertNotNull(callback); - assertEquals(asylumCase, callbackResponse.getData()); - final Set errors = callbackResponse.getErrors(); - assertThat(errors).isEmpty(); - verify(asylumCase).write(FTPA_RESPONDENT_DECISION_OBJECTIONS_VISIBLE, YesOrNo.YES); - } - - @Test - void should_successfully_set_appellant_decision_objections_page_visibility_when_reheard_rule35() { - - when(callback.getEvent()).thenReturn(Event.RESIDENT_JUDGE_FTPA_DECISION); - when(asylumCase.read(FTPA_APPLICANT_TYPE, String.class)).thenReturn(Optional.of(Parties.APPELLANT.toString())); - when(asylumCase.read(FTPA_APPELLANT_SUBMITTED, String.class)).thenReturn(Optional.of(YesOrNo.YES.toString())); - - when(asylumCase.read(FTPA_APPELLANT_RJ_DECISION_OUTCOME_TYPE, String.class)) - .thenReturn(Optional.of(FtpaResidentJudgeDecisionOutcomeType.REHEARD_RULE35.toString())); - - - PreSubmitCallbackResponse callbackResponse = - ftpaDecisionMidEvent.handle(MID_EVENT, callback); - - assertNotNull(callback); - assertEquals(asylumCase, callbackResponse.getData()); - final Set errors = callbackResponse.getErrors(); - assertThat(errors).isEmpty(); - verify(asylumCase).write(FTPA_APPELLANT_DECISION_OBJECTIONS_VISIBLE, YesOrNo.YES); - } - - @Test - void should_successfully_set_respondent_decision_objections_page_visibility_when_reheard_rule35() { - - when(callback.getEvent()).thenReturn(Event.LEADERSHIP_JUDGE_FTPA_DECISION); - when(asylumCase.read(FTPA_APPLICANT_TYPE, String.class)).thenReturn(Optional.of(Parties.RESPONDENT.toString())); - when(asylumCase.read(FTPA_RESPONDENT_SUBMITTED, String.class)).thenReturn(Optional.of(YesOrNo.YES.toString())); - - when(asylumCase.read(FTPA_RESPONDENT_RJ_DECISION_OUTCOME_TYPE, String.class)) - .thenReturn(Optional.of(FtpaResidentJudgeDecisionOutcomeType.REHEARD_RULE35.toString())); - - - PreSubmitCallbackResponse callbackResponse = - ftpaDecisionMidEvent.handle(MID_EVENT, callback); - - assertNotNull(callback); - assertEquals(asylumCase, callbackResponse.getData()); - final Set errors = callbackResponse.getErrors(); - assertThat(errors).isEmpty(); - verify(asylumCase).write(FTPA_RESPONDENT_DECISION_OBJECTIONS_VISIBLE, YesOrNo.YES); - } - @Test void should_successfully_set_appellant_decision_reasons_notes_visibility_when_granted() { @@ -630,72 +520,28 @@ void should_successfully_set_respondent_decision_listing_visibility_when_reheard verify(asylumCase).write(FTPA_RESPONDENT_DECISION_LISTING_VISIBLE, YesOrNo.YES); } - @Test - void should_successfully_set_appellant_decision_listing_visibility_when_reheard_rule32() { - - when(callback.getEvent()).thenReturn(Event.RESIDENT_JUDGE_FTPA_DECISION); - when(asylumCase.read(FTPA_APPLICANT_TYPE, String.class)).thenReturn(Optional.of(Parties.APPELLANT.toString())); - when(asylumCase.read(FTPA_APPELLANT_SUBMITTED, String.class)).thenReturn(Optional.of(YesOrNo.YES.toString())); - - when(asylumCase.read(FTPA_APPELLANT_RJ_DECISION_OUTCOME_TYPE, String.class)) - .thenReturn(Optional.of(FtpaResidentJudgeDecisionOutcomeType.REHEARD_RULE32.toString())); - - - PreSubmitCallbackResponse callbackResponse = - ftpaDecisionMidEvent.handle(MID_EVENT, callback); - - assertNotNull(callback); - assertEquals(asylumCase, callbackResponse.getData()); - final Set errors = callbackResponse.getErrors(); - assertThat(errors).isEmpty(); - verify(asylumCase).write(FTPA_APPELLANT_DECISION_LISTING_VISIBLE, YesOrNo.YES); - } - - @Test - void should_successfully_set_respondent_decision_listing_visibility_when_reheard_rule32() { - - when(callback.getEvent()).thenReturn(Event.RESIDENT_JUDGE_FTPA_DECISION); - when(asylumCase.read(FTPA_APPLICANT_TYPE, String.class)).thenReturn(Optional.of(Parties.RESPONDENT.toString())); - when(asylumCase.read(FTPA_RESPONDENT_SUBMITTED, String.class)).thenReturn(Optional.of(YesOrNo.YES.toString())); - - when(asylumCase.read(FTPA_RESPONDENT_RJ_DECISION_OUTCOME_TYPE, String.class)) - .thenReturn(Optional.of(FtpaResidentJudgeDecisionOutcomeType.REHEARD_RULE32.toString())); - - - PreSubmitCallbackResponse callbackResponse = - ftpaDecisionMidEvent.handle(MID_EVENT, callback); - - assertNotNull(callback); - assertEquals(asylumCase, callbackResponse.getData()); - final Set errors = callbackResponse.getErrors(); - assertThat(errors).isEmpty(); - verify(asylumCase).write(FTPA_RESPONDENT_DECISION_LISTING_VISIBLE, YesOrNo.YES); - } - @ParameterizedTest @CsvSource({ "FTPA_APPELLANT_SUBMITTED, APPELLANT, FTPA_APPELLANT_RJ_DECISION_OUTCOME_TYPE, REHEARD_RULE35", - "FTPA_APPELLANT_SUBMITTED, APPELLANT, FTPA_APPELLANT_RJ_DECISION_OUTCOME_TYPE, REHEARD_RULE32", "FTPA_APPELLANT_SUBMITTED, APPELLANT, FTPA_APPELLANT_RJ_DECISION_OUTCOME_TYPE, REMADE_RULE32", "FTPA_RESPONDENT_SUBMITTED, RESPONDENT, FTPA_RESPONDENT_RJ_DECISION_OUTCOME_TYPE, REHEARD_RULE35", - "FTPA_RESPONDENT_SUBMITTED, RESPONDENT, FTPA_RESPONDENT_RJ_DECISION_OUTCOME_TYPE, REHEARD_RULE32", "FTPA_RESPONDENT_SUBMITTED, RESPONDENT, FTPA_RESPONDENT_RJ_DECISION_OUTCOME_TYPE, REMADE_RULE32", }) void should_return_error_when_rj_select_appellant_or_respondent_for_reheard_rule35_rule32_or_remade_rule32_in_aip( - AsylumCaseFieldDefinition ftpaSubmitted, - Parties party, - AsylumCaseFieldDefinition ftpaRjDecisionOutcomeType, - FtpaResidentJudgeDecisionOutcomeType selection + AsylumCaseFieldDefinition ftpaSubmitted, + Parties party, + AsylumCaseFieldDefinition ftpaRjDecisionOutcomeType, + FtpaResidentJudgeDecisionOutcomeType selection ) { when(callback.getEvent()).thenReturn(Event.RESIDENT_JUDGE_FTPA_DECISION); when(asylumCase.read(ftpaSubmitted, String.class)).thenReturn(Optional.of(YesOrNo.YES.toString())); when(asylumCase.read(FTPA_APPLICANT_TYPE, String.class)).thenReturn(Optional.of(party.toString())); when(asylumCase.read(JOURNEY_TYPE, JourneyType.class)).thenReturn(Optional.of(JourneyType.AIP)); when(asylumCase.read(ftpaRjDecisionOutcomeType, String.class)) - .thenReturn(Optional.of(selection.toString())); + .thenReturn(Optional.of(selection.toString())); PreSubmitCallbackResponse callbackResponse = - ftpaDecisionMidEvent.handle(MID_EVENT, callback); + ftpaDecisionMidEvent.handle(MID_EVENT, callback); assertNotNull(callback); assertEquals(asylumCase, callbackResponse.getData()); @@ -709,25 +555,27 @@ void should_return_error_when_rj_select_appellant_or_respondent_for_reheard_rule "FTPA_APPELLANT_SUBMITTED, APPELLANT, FTPA_APPELLANT_RJ_DECISION_OUTCOME_TYPE, GRANTED", "FTPA_APPELLANT_SUBMITTED, APPELLANT, FTPA_APPELLANT_RJ_DECISION_OUTCOME_TYPE, PARTIALLY_GRANTED", "FTPA_APPELLANT_SUBMITTED, APPELLANT, FTPA_APPELLANT_RJ_DECISION_OUTCOME_TYPE, REFUSED", + "FTPA_APPELLANT_SUBMITTED, APPELLANT, FTPA_APPELLANT_RJ_DECISION_OUTCOME_TYPE, APPLICATION_NOT_ADMITTED", "FTPA_RESPONDENT_SUBMITTED, RESPONDENT, FTPA_RESPONDENT_RJ_DECISION_OUTCOME_TYPE, GRANTED", "FTPA_RESPONDENT_SUBMITTED, RESPONDENT, FTPA_RESPONDENT_RJ_DECISION_OUTCOME_TYPE, PARTIALLY_GRANTED", "FTPA_RESPONDENT_SUBMITTED, RESPONDENT, FTPA_RESPONDENT_RJ_DECISION_OUTCOME_TYPE, REFUSED", + "FTPA_RESPONDENT_SUBMITTED, RESPONDENT, FTPA_RESPONDENT_RJ_DECISION_OUTCOME_TYPE, APPLICATION_NOT_ADMITTED", }) void should_record_when_rj_select_appellant_or_respondent_for_non_reheard_rule35_rule32_or_remade_rule32_in_aip( - AsylumCaseFieldDefinition ftpaSubmitted, - Parties party, - AsylumCaseFieldDefinition ftpaRjDecisionOutcomeType, - FtpaResidentJudgeDecisionOutcomeType selection + AsylumCaseFieldDefinition ftpaSubmitted, + Parties party, + AsylumCaseFieldDefinition ftpaRjDecisionOutcomeType, + FtpaResidentJudgeDecisionOutcomeType selection ) { when(callback.getEvent()).thenReturn(Event.RESIDENT_JUDGE_FTPA_DECISION); when(asylumCase.read(ftpaSubmitted, String.class)).thenReturn(Optional.of(YesOrNo.YES.toString())); when(asylumCase.read(FTPA_APPLICANT_TYPE, String.class)).thenReturn(Optional.of(party.toString())); when(asylumCase.read(JOURNEY_TYPE, JourneyType.class)).thenReturn(Optional.of(JourneyType.AIP)); when(asylumCase.read(ftpaRjDecisionOutcomeType, String.class)) - .thenReturn(Optional.of(selection.toString())); + .thenReturn(Optional.of(selection.toString())); PreSubmitCallbackResponse callbackResponse = - ftpaDecisionMidEvent.handle(MID_EVENT, callback); + ftpaDecisionMidEvent.handle(MID_EVENT, callback); assertNotNull(callback); assertEquals(asylumCase, callbackResponse.getData()); diff --git a/src/test/java/uk/gov/hmcts/reform/iacaseapi/domain/handlers/presubmit/UpperTribunalBundlePreparerTest.java b/src/test/java/uk/gov/hmcts/reform/iacaseapi/domain/handlers/presubmit/UpperTribunalBundlePreparerTest.java index 7b12cd4ecc..42e3c2d717 100644 --- a/src/test/java/uk/gov/hmcts/reform/iacaseapi/domain/handlers/presubmit/UpperTribunalBundlePreparerTest.java +++ b/src/test/java/uk/gov/hmcts/reform/iacaseapi/domain/handlers/presubmit/UpperTribunalBundlePreparerTest.java @@ -37,24 +37,6 @@ public void setup() { upperTribunalBundlePreparer = new UpperTribunalBundlePreparer(); } - @Test - void should_throw_error_for_reheard_rule_32_respondent_decision() { - - when(callback.getCaseDetails()).thenReturn(caseDetails); - when(callback.getEvent()).thenReturn(Event.GENERATE_UPPER_TRIBUNAL_BUNDLE); - when(caseDetails.getCaseData()).thenReturn(asylumCase); - - when(asylumCase.read(AsylumCaseFieldDefinition.FTPA_RESPONDENT_RJ_DECISION_OUTCOME_TYPE, String.class)) - .thenReturn(Optional.of(FtpaResidentJudgeDecisionOutcomeType.REHEARD_RULE32.toString())); - - PreSubmitCallbackResponse callbackResponse = - upperTribunalBundlePreparer.handle(PreSubmitCallbackStage.ABOUT_TO_START, callback); - - assertNotNull(callbackResponse); - assertEquals(1, callbackResponse.getErrors().size()); - assertTrue(callbackResponse.getErrors().contains("You cannot generate an Upper Tribunal bundle because this appeal will not be heard by the Upper Tribunal.")); - } - @Test void should_throw_error_for_reheard_rule_35_respondent_decision() { @@ -91,27 +73,6 @@ void should_throw_error_for_remade_rule_32_respondent_decision() { assertTrue(callbackResponse.getErrors().contains("You cannot generate an Upper Tribunal bundle because this appeal will not be heard by the Upper Tribunal.")); } - @Test - void should_throw_error_for_reheard_rule_32_appellant_decision() { - - when(callback.getCaseDetails()).thenReturn(caseDetails); - when(callback.getEvent()).thenReturn(Event.GENERATE_UPPER_TRIBUNAL_BUNDLE); - when(caseDetails.getCaseData()).thenReturn(asylumCase); - - when(asylumCase.read(AsylumCaseFieldDefinition.FTPA_RESPONDENT_RJ_DECISION_OUTCOME_TYPE, String.class)) - .thenReturn(Optional.empty()); - - when(asylumCase.read(AsylumCaseFieldDefinition.FTPA_APPELLANT_RJ_DECISION_OUTCOME_TYPE, String.class)) - .thenReturn(Optional.of(FtpaResidentJudgeDecisionOutcomeType.REHEARD_RULE32.toString())); - - PreSubmitCallbackResponse callbackResponse = - upperTribunalBundlePreparer.handle(PreSubmitCallbackStage.ABOUT_TO_START, callback); - - assertNotNull(callbackResponse); - assertEquals(1, callbackResponse.getErrors().size()); - assertTrue(callbackResponse.getErrors().contains("You cannot generate an Upper Tribunal bundle because this appeal will not be heard by the Upper Tribunal.")); - } - @Test void should_throw_error_for_reheard_rule_35_appellant_decision() {