Skip to content

Commit

Permalink
SSCSCI-1456 (#1705)
Browse files Browse the repository at this point in the history
* Revert "Revert "SSCSCI-1456" (#1704)"

This reverts commit aa5e8ae.

* fix by adding constructor without hmcHearingType

* attempted fix

* checkstyle fix

* removing redundant constructor and isNullCheck
  • Loading branch information
nilay913 authored Feb 19, 2025
1 parent aa5e8ae commit 06761f9
Show file tree
Hide file tree
Showing 5 changed files with 71 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ public class HearingOptions {
private String agreeLessNotice;
private HearingRoute hearingRoute;
private String other;
@JsonInclude(JsonInclude.Include.NON_NULL)
private HmcHearingType hmcHearingType;

@JsonCreator
public HearingOptions(@JsonProperty("wantsToAttend") String wantsToAttend,
Expand All @@ -38,7 +40,8 @@ public HearingOptions(@JsonProperty("wantsToAttend") String wantsToAttend,
@JsonProperty("excludeDates") List<ExcludeDate> excludeDates,
@JsonProperty("agreeLessNotice") String agreeLessNotice,
@JsonProperty("hearingRoute") HearingRoute hearingRoute,
@JsonProperty("other") String other) {
@JsonProperty("other") String other,
@JsonProperty("hmcHearingType") HmcHearingType hmcHearingType) {
this.wantsToAttend = wantsToAttend;
this.wantsSupport = wantsSupport;
this.languageInterpreter = languageInterpreter;
Expand All @@ -51,16 +54,17 @@ public HearingOptions(@JsonProperty("wantsToAttend") String wantsToAttend,
this.agreeLessNotice = agreeLessNotice;
this.hearingRoute = hearingRoute;
this.other = other;
this.hmcHearingType = hmcHearingType;
}

@JsonIgnore
public Boolean isWantsToAttendHearing() {
return StringUtils.isNotBlank(wantsToAttend) && wantsToAttend.toLowerCase().equals("yes");
return StringUtils.isNotBlank(wantsToAttend) && wantsToAttend.equalsIgnoreCase("yes");
}

@JsonIgnore
public Boolean isAgreeLessNotice() {
return StringUtils.isNotBlank(agreeLessNotice) && agreeLessNotice.toLowerCase().equals("yes");
return StringUtils.isNotBlank(agreeLessNotice) && agreeLessNotice.equalsIgnoreCase("yes");
}

public Boolean wantsSignLanguageInterpreter() {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package uk.gov.hmcts.reform.sscs.ccd.domain;

import com.fasterxml.jackson.annotation.JsonValue;
import lombok.Getter;
import lombok.RequiredArgsConstructor;

@Getter
@RequiredArgsConstructor
public enum HmcHearingType {
SUBSTANTIVE("BBA3-SUB", "Substantive", null),
DIRECTION_HEARINGS("BBA3-DIR", "Direction Hearings", null),
CHAMBERS_OUTCOME("BBA3-CHA", "Chambers Outcome", null);

private final String hmcReference;
private final String valueEn;
private final String valueCy;

@Override
@JsonValue
public String toString() {
return hmcReference;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,21 @@
@Builder(toBuilder = true)
@AllArgsConstructor
@NoArgsConstructor
@JsonInclude
public class OverrideFields {
@JsonInclude
private Integer duration;
@JsonInclude
private HearingInterpreter appellantInterpreter;
@JsonInclude
private HearingChannel appellantHearingChannel;
@JsonInclude
private HearingWindow hearingWindow;
@JsonInclude
private YesNo autoList;
@JsonInclude
private List<CcdValue<CcdValue<String>>> hearingVenueEpimsIds;
@JsonInclude(JsonInclude.Include.NON_NULL)
private HmcHearingType hmcHearingType;

@SuppressWarnings("unused")
@JsonIgnore
Expand All @@ -34,6 +41,7 @@ && isNull(appellantInterpreter)
&& isNull(appellantHearingChannel)
&& isNull(hearingWindow)
&& isNull(autoList)
&& isNull(hearingVenueEpimsIds);
&& isNull(hearingVenueEpimsIds)
&& isNull(hmcHearingType);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -404,6 +404,12 @@ public class SscsCaseData implements CaseData {

private YesNo ignoreCallbackWarnings;

@JsonInclude(JsonInclude.Include.NON_NULL)
private YesNo selectNextHmcHearingType;

@JsonInclude(JsonInclude.Include.NON_NULL)
private HmcHearingType hmcHearingType;

@JsonIgnore
private EventDetails getLatestEvent() {
return events != null && !events.isEmpty() ? events.get(0).getValue() : null;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package uk.gov.hmcts.reform.sscs.ccd.domain;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;

import junitparams.JUnitParamsRunner;
import junitparams.Parameters;
import org.junit.Test;
import org.junit.runner.RunWith;

@RunWith(JUnitParamsRunner.class)
public class HmcHearingTypeTest {

@Test
@Parameters({
"SUBSTANTIVE,BBA3-SUB,Substantive",
"DIRECTION_HEARINGS,BBA3-DIR,Direction Hearings",
"CHAMBERS_OUTCOME,BBA3-CHA,Chambers Outcome"
})
public void shouldReturnCorrectValues(HmcHearingType hmcHearingType, String hmcReference, String valueEn) {
assertEquals(hmcReference, hmcHearingType.getHmcReference());
assertEquals(valueEn, hmcHearingType.getValueEn());
assertNull(hmcHearingType.getValueCy());
}
}

0 comments on commit 06761f9

Please sign in to comment.