use of uk.gov.hmcts.probate.model.ccd.raw.request.CallbackRequest in project probate-back-office by hmcts.
the class BusinessValidationControllerTest method shouldSuccesfullyGenerateTrustCorpsProbateDeclaration.
@Test
public void shouldSuccesfullyGenerateTrustCorpsProbateDeclaration() throws Exception {
CaseDetails caseDetails = new CaseDetails(caseDataBuilder.build(), LAST_MODIFIED, ID);
CallbackRequest callbackRequest = new CallbackRequest(caseDetails);
String json = OBJECT_MAPPER.writeValueAsString(callbackRequest);
Document probateDocument = Document.builder().documentType(DocumentType.LEGAL_STATEMENT_PROBATE_TRUST_CORPS).documentLink(DocumentLink.builder().documentFilename("legalStatementGrantOfProbate.pdf").build()).build();
when(pdfManagementService.generateAndUpload(any(CallbackRequest.class), any(DocumentType.class))).thenReturn(probateDocument);
mockMvc.perform(post(SOLS_VALIDATE_PROBATE_URL).content(json).contentType(MediaType.APPLICATION_JSON)).andExpect(status().isOk()).andExpect(content().contentType(MediaType.APPLICATION_JSON)).andExpect(jsonPath("$.data.solsLegalStatementDocument.document_filename").value("legalStatementGrantOfProbate.pdf"));
}
use of uk.gov.hmcts.probate.model.ccd.raw.request.CallbackRequest in project probate-back-office by hmcts.
the class BusinessValidationControllerTest method shouldSetupIHTEstate.
@Test
public void shouldSetupIHTEstate() throws Exception {
CaseDetails caseDetails = new CaseDetails(caseDataBuilder.build(), LAST_MODIFIED, ID);
CallbackRequest callbackRequest = new CallbackRequest(caseDetails);
String json = OBJECT_MAPPER.writeValueAsString(callbackRequest);
mockMvc.perform(post(SOLS_DEFAULT_IHT_ESTATE_URL).content(json).contentType(MediaType.APPLICATION_JSON)).andExpect(status().isOk());
}
use of uk.gov.hmcts.probate.model.ccd.raw.request.CallbackRequest in project probate-back-office by hmcts.
the class BusinessValidationControllerTest method validateDobIsNullError.
private void validateDobIsNullError(String url) throws Exception {
caseDataBuilder.deceasedDateOfBirth(null);
CaseDetails caseDetails = new CaseDetails(caseDataBuilder.build(), LAST_MODIFIED, ID);
CallbackRequest callbackRequest = new CallbackRequest(caseDetails);
String json = OBJECT_MAPPER.writeValueAsString(callbackRequest);
mockMvc.perform(post(url).content(json).contentType(MediaType.APPLICATION_JSON)).andExpect(status().isBadRequest()).andExpect(content().contentType(MediaType.APPLICATION_JSON)).andExpect(jsonPath("$.fieldErrors[0].param").value("callbackRequest")).andExpect(jsonPath("$.fieldErrors[0].field").value("caseDetails.data.deceasedDateOfBirth")).andExpect(jsonPath("$.fieldErrors[0].code").value("NotNull")).andExpect(jsonPath("$.fieldErrors[0].message").value("Date of birth cannot be empty"));
}
use of uk.gov.hmcts.probate.model.ccd.raw.request.CallbackRequest in project probate-back-office by hmcts.
the class BusinessValidationControllerTest method shouldNotValidateWithCodicilDateBeforeWillDate.
@Test
public void shouldNotValidateWithCodicilDateBeforeWillDate() throws Exception {
final List<CollectionMember<CodicilAddedDate>> codicilDates = Arrays.asList(new CollectionMember<>(CodicilAddedDate.builder().dateCodicilAdded(LocalDate.now().minusDays(2)).build()));
caseDataBuilder.codicilAddedDateList(codicilDates);
caseDataBuilder.originalWillSignedDate(LocalDate.now().minusDays(1));
CaseDetails caseDetails = new CaseDetails(caseDataBuilder.build(), LAST_MODIFIED, ID);
CallbackRequest callbackRequest = new CallbackRequest(caseDetails);
String json = OBJECT_MAPPER.writeValueAsString(callbackRequest);
mockMvc.perform(post(SOLS_VALIDATE_WILL_AND_CODICIL_DATES_URL).content(json).contentType(MediaType.APPLICATION_JSON)).andExpect(content().contentType(MediaType.APPLICATION_JSON)).andExpect(jsonPath("$.errors[0]").value("A codicil cannot be made before the will was signed"));
}
use of uk.gov.hmcts.probate.model.ccd.raw.request.CallbackRequest in project probate-back-office by hmcts.
the class BusinessValidationControllerTest method shouldNotValidateWithCodicilDateOnWillDate.
@Test
public void shouldNotValidateWithCodicilDateOnWillDate() throws Exception {
final List<CollectionMember<CodicilAddedDate>> codicilDates = Arrays.asList(new CollectionMember<>(CodicilAddedDate.builder().dateCodicilAdded(LocalDate.now().minusDays(1)).build()));
caseDataBuilder.codicilAddedDateList(codicilDates);
caseDataBuilder.originalWillSignedDate(LocalDate.now().minusDays(1));
CaseDetails caseDetails = new CaseDetails(caseDataBuilder.build(), LAST_MODIFIED, ID);
CallbackRequest callbackRequest = new CallbackRequest(caseDetails);
String json = OBJECT_MAPPER.writeValueAsString(callbackRequest);
mockMvc.perform(post(SOLS_VALIDATE_WILL_AND_CODICIL_DATES_URL).content(json).contentType(MediaType.APPLICATION_JSON)).andExpect(content().contentType(MediaType.APPLICATION_JSON)).andExpect(jsonPath("$.errors[0]").value("A codicil cannot be made before the will was signed"));
}
Aggregations