Skip to content

Commit

Permalink
SSCSCI-1406: BenefitType update to consolidate ibc code in tribunals (#…
Browse files Browse the repository at this point in the history
…1670)

* SSCSCI-1406: BenefitType update to consolidate ibc code in tribunals

* SSCSCI-1406: Moving isIbc to upper level to capture benefitCode string

* SSCSCI-1406: Minor cleanup to use static import

* SSCSCI-1406: Cleaning up imports

* SSCSCI-1406: Removing unused import and unit tests
  • Loading branch information
Tim97eng authored Nov 20, 2024
1 parent 020dd58 commit 002aafb
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import static java.util.Optional.ofNullable;
import static org.apache.commons.collections4.ListUtils.emptyIfNull;
import static org.apache.commons.lang3.ObjectUtils.isNotEmpty;
import static uk.gov.hmcts.reform.sscs.ccd.domain.Benefit.INFECTED_BLOOD_COMPENSATION;
import static uk.gov.hmcts.reform.sscs.ccd.domain.Benefit.findBenefitByShortName;
import static uk.gov.hmcts.reform.sscs.ccd.domain.DwpState.FINAL_DECISION_ISSUED;
import static uk.gov.hmcts.reform.sscs.ccd.domain.YesNo.NO;
Expand Down Expand Up @@ -759,6 +760,14 @@ public Optional<Benefit> getBenefitType() {
}
}

@JsonIgnore
public boolean isIbcCase() {
return INFECTED_BLOOD_COMPENSATION.getBenefitCode().equals(benefitCode)
|| getBenefitType()
.map(INFECTED_BLOOD_COMPENSATION::equals)
.orElse(false);
}

@JsonIgnore
public Optional<LocalDateTime> getDateTimeSentToGaps() {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import static uk.gov.hmcts.reform.sscs.ccd.domain.Benefit.CHILD_BENEFIT;
import static uk.gov.hmcts.reform.sscs.ccd.domain.Benefit.INFECTED_BLOOD_COMPENSATION;
import static uk.gov.hmcts.reform.sscs.ccd.domain.YesNo.NO;
import static uk.gov.hmcts.reform.sscs.ccd.domain.YesNo.YES;

Expand Down Expand Up @@ -961,4 +963,37 @@ public void givenHasJointPartyIsNo_thenIsThereAJointPartyIsFalse() {

assertFalse(caseData.isThereAJointParty());
}

@Test
public void givenBenefitCodeIsSetIba_thenIsIbcIsTrue() {
SscsCaseData sscsCaseData = SscsCaseData.builder()
.benefitCode(INFECTED_BLOOD_COMPENSATION.getBenefitCode()).build();

assertTrue(sscsCaseData.isIbcCase());
}

@Test
public void givenAppealBenefitCodeIsSetIba_thenIsIbcIsTrue() {
SscsCaseData sscsCaseData = SscsCaseData.builder()
.appeal(Appeal.builder().benefitType(BenefitType.builder().code(INFECTED_BLOOD_COMPENSATION.getShortName()).build()).build()).build();

assertTrue(sscsCaseData.isIbcCase());
}

@Test
public void givenAppealBenefitCodeIsSetOnlyNonIba_thenIsIbcIsFalse() {
SscsCaseData sscsCaseData = SscsCaseData.builder()
.appeal(Appeal.builder().benefitType(BenefitType.builder().code(CHILD_BENEFIT.getShortName()).build()).build()).build();

assertFalse(sscsCaseData.isIbcCase());
}

@Test
@Parameters({"030", "034", "016"})
public void givenBenefitCodeIsSetOnlyNonIba_thenIsIbcIsFalse(String benefitCode) {
SscsCaseData sscsCaseData = SscsCaseData.builder()
.benefitCode(benefitCode).build();

assertFalse(sscsCaseData.isIbcCase());
}
}

0 comments on commit 002aafb

Please sign in to comment.