Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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 @@ -37,6 +37,9 @@
},
"parentGuardian": {
"$ref": "#/definitions/parentGuardian"
},
"isCivil": {
"type": "boolean"
}
},
"required": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,7 @@ public CourtExtractRequested getCourtExtractRequested(final GetHearingsAtAGlance

courtExtract.withExtractType(extractType);
courtExtract.withCaseReference(transformationHelper.getCaseReference(hearingsAtAGlance.getProsecutionCaseIdentifier()));
courtExtract.withIsCivil(prosecutionCase.getIsCivil());

if (caseDefendant.isPresent()) {
final List<AssociatedPerson> associatedPersons = caseDefendant.get().getAssociatedPersons();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import static org.hamcrest.Matchers.anyOf;
import static org.hamcrest.Matchers.is;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.when;
Expand Down Expand Up @@ -452,6 +453,19 @@ public void testTransformToCourtExtract_shouldUseDefendantAssociatedDefenceOrgan
assertThat(defendant2ndResults.size(), is(2));
}

@Test
void testTransformToCourtExtract_shouldReturnIsCivilFlag(){
String defendantId = "5c75653a-e264-4b59-a419-66221b725a58";

final JsonObject prosecutionCasePayload = stringToJsonObjectConverter.convert(getPayload("court-extract/progression.query.prosecutioncase-multiple-defendants.json"));
final JsonObject hearingsAtAGlanceJson = prosecutionCasePayload.getJsonObject("hearingsAtAGlance");
GetHearingsAtAGlance hearingsAtAGlance = jsonObjectToObjectConverter.convert(hearingsAtAGlanceJson, GetHearingsAtAGlance.class);
ProsecutionCase prosecutionCase1 = createProsecutionCase(true);

final CourtExtractRequested courtExtractRequested = target.getCourtExtractRequested(hearingsAtAGlance, defendantId, "RecordSheet", emptyList(), randomUUID(), prosecutionCase1);
assertTrue(courtExtractRequested.getIsCivil());
}

private static void assertAttendanceDays(final List<AttendanceDayAndType> attendanceDays) {
assertThat(attendanceDays.size(), is((2)));
attendanceDays.forEach(ad -> anyOf(is(CourtExtractTransformer.PRESENT_BY_POLICE_VIDEO_LINK),
Expand Down Expand Up @@ -1824,6 +1838,10 @@ private ProsecutionCase getProsecutionCaseForLegalEntityDefendant() {
}

private ProsecutionCase createProsecutionCase() {
return createProsecutionCase(false);
}

private ProsecutionCase createProsecutionCase(boolean isCivil) {
final Defendant defendant = Defendant.defendant().withId(DEFENDANT_ID)
.withPersonDefendant(createPersonDefendant())
.withAssociatedPersons(asList(AssociatedPerson.associatedPerson()
Expand Down Expand Up @@ -1866,17 +1884,16 @@ private ProsecutionCase createProsecutionCase() {
add(defendant_2nd);
}};

final ProsecutionCase prosecutionCase = ProsecutionCase.prosecutionCase()
return ProsecutionCase.prosecutionCase()
.withId(CASE_ID)
.withDefendants(defendants)
.withProsecutionCaseIdentifier(ProsecutionCaseIdentifier.prosecutionCaseIdentifier()
.withProsecutionAuthorityId(randomUUID())
.withProsecutionAuthorityCode("code")
.withProsecutionAuthorityReference(PAR)
.build())
.withIsCivil(isCivil)
.build();

return prosecutionCase;
}

private GetHearingsAtAGlance createHearingsAtGlance() {
Expand Down
Loading