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 @@ -8,6 +8,7 @@
import uk.gov.justice.services.messaging.JsonEnvelope;
import uk.gov.moj.cpp.sjp.domain.decision.Dismiss;
import uk.gov.moj.cpp.sjp.domain.decision.OffenceDecision;
import uk.gov.moj.cpp.sjp.event.processor.results.converter.ConvictionInfo;
import uk.gov.moj.cpp.sjp.event.processor.results.converter.judicialresult.JCachedReferenceData;
import uk.gov.moj.cpp.sjp.event.processor.results.converter.judicialresult.DecisionAggregate;

Expand Down Expand Up @@ -49,6 +50,13 @@ public void aggregate(final OffenceDecision offenceDecision,

setFinalOffence(decisionAggregate, offenceId, judicialResults);

// conviction information - a dismissal carries the FOUND_NOT_GUILTY verdict dated on the
// resulting date but has no convicting court
decisionAggregate.putConvictionInfo(offenceId,
new ConvictionInfo(offenceId,
dismissOffenceDecision.getOffenceDecisionInformation().getVerdict(),
resultedOn.toLocalDate(),
null));
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@
import static org.hamcrest.Matchers.hasProperty;
import static org.hamcrest.MatcherAssert.assertThat;
import static uk.gov.moj.cpp.sjp.domain.decision.OffenceDecisionInformation.createOffenceDecisionInformation;
import static uk.gov.moj.cpp.sjp.domain.verdict.VerdictType.FOUND_GUILTY;
import static uk.gov.moj.cpp.sjp.domain.verdict.VerdictType.FOUND_NOT_GUILTY;
import static uk.gov.moj.cpp.sjp.event.processor.results.converter.judicialresult.JCaseResultsConstants.DATE_FORMAT;

import uk.gov.moj.cpp.sjp.domain.decision.Dismiss;
import uk.gov.moj.cpp.sjp.event.processor.results.converter.ConvictionInfo;
import uk.gov.moj.cpp.sjp.event.processor.results.converter.judicialresult.DecisionAggregate;

import org.hamcrest.Matchers;
Expand All @@ -37,7 +38,7 @@ public void setUp() {
@Test
public void shouldPopulateResultWithRightPrompts() {
final Dismiss offenceDecision
= new Dismiss(null, createOffenceDecisionInformation(offence1Id, FOUND_GUILTY));
= new Dismiss(null, createOffenceDecisionInformation(offence1Id, FOUND_NOT_GUILTY));

aggregator.aggregate(offenceDecision, sjpSessionEnvelope, resultsAggregate, resultedOn);

Expand All @@ -49,4 +50,19 @@ public void shouldPopulateResultWithRightPrompts() {
hasProperty("judicialResultPrompts", is(nullValue()))))));
assertThat(resultsAggregate.getFinalOffence(offenceDecision.getOffenceIds().get(0)),Matchers.is(true));
}

@Test
public void shouldPopulateConvictionInfoWithFoundNotGuiltyVerdict() {
final Dismiss offenceDecision
= new Dismiss(null, createOffenceDecisionInformation(offence1Id, FOUND_NOT_GUILTY));

aggregator.aggregate(offenceDecision, sjpSessionEnvelope, resultsAggregate, resultedOn);

final ConvictionInfo convictionInfo = resultsAggregate.getConvictionInfo(offence1Id);
assertThat(convictionInfo, is(Matchers.notNullValue()));
assertThat(convictionInfo.getOffenceId(), Matchers.is(offence1Id));
assertThat(convictionInfo.getVerdictType(), Matchers.is(FOUND_NOT_GUILTY));
assertThat(convictionInfo.getConvictionDate(), is(resultedOn.toLocalDate()));
assertThat(convictionInfo.getConvictingCourt(), is(nullValue()));
}
}
Loading