Search in sources :

Example 1 with CallbackRequest

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"));
}
Also used : CallbackRequest(uk.gov.hmcts.probate.model.ccd.raw.request.CallbackRequest) CaseDetails(uk.gov.hmcts.probate.model.ccd.raw.request.CaseDetails) DocumentType(uk.gov.hmcts.probate.model.DocumentType) Matchers.containsString(org.hamcrest.Matchers.containsString) Document(uk.gov.hmcts.probate.model.ccd.raw.Document) ScannedDocument(uk.gov.hmcts.probate.model.ccd.raw.ScannedDocument) SpringBootTest(org.springframework.boot.test.context.SpringBootTest) Test(org.junit.Test)

Example 2 with CallbackRequest

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());
}
Also used : CallbackRequest(uk.gov.hmcts.probate.model.ccd.raw.request.CallbackRequest) CaseDetails(uk.gov.hmcts.probate.model.ccd.raw.request.CaseDetails) Matchers.containsString(org.hamcrest.Matchers.containsString) SpringBootTest(org.springframework.boot.test.context.SpringBootTest) Test(org.junit.Test)

Example 3 with CallbackRequest

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"));
}
Also used : CallbackRequest(uk.gov.hmcts.probate.model.ccd.raw.request.CallbackRequest) CaseDetails(uk.gov.hmcts.probate.model.ccd.raw.request.CaseDetails) Matchers.containsString(org.hamcrest.Matchers.containsString)

Example 4 with CallbackRequest

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"));
}
Also used : CallbackRequest(uk.gov.hmcts.probate.model.ccd.raw.request.CallbackRequest) CaseDetails(uk.gov.hmcts.probate.model.ccd.raw.request.CaseDetails) CollectionMember(uk.gov.hmcts.probate.model.ccd.raw.CollectionMember) Matchers.containsString(org.hamcrest.Matchers.containsString) SpringBootTest(org.springframework.boot.test.context.SpringBootTest) Test(org.junit.Test)

Example 5 with CallbackRequest

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"));
}
Also used : CallbackRequest(uk.gov.hmcts.probate.model.ccd.raw.request.CallbackRequest) CaseDetails(uk.gov.hmcts.probate.model.ccd.raw.request.CaseDetails) CollectionMember(uk.gov.hmcts.probate.model.ccd.raw.CollectionMember) Matchers.containsString(org.hamcrest.Matchers.containsString) SpringBootTest(org.springframework.boot.test.context.SpringBootTest) Test(org.junit.Test)

Aggregations

CallbackRequest (uk.gov.hmcts.probate.model.ccd.raw.request.CallbackRequest)115 Test (org.junit.Test)101 CaseDetails (uk.gov.hmcts.probate.model.ccd.raw.request.CaseDetails)98 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)48 Document (uk.gov.hmcts.probate.model.ccd.raw.Document)31 Matchers.containsString (org.hamcrest.Matchers.containsString)28 CaseData (uk.gov.hmcts.probate.model.ccd.raw.request.CaseData)23 ResponseCaseData (uk.gov.hmcts.probate.model.ccd.raw.response.ResponseCaseData)21 CallbackResponse (uk.gov.hmcts.probate.model.ccd.raw.response.CallbackResponse)20 ScannedDocument (uk.gov.hmcts.probate.model.ccd.raw.ScannedDocument)17 SendLetterResponse (uk.gov.hmcts.reform.sendletter.api.SendLetterResponse)16 DocumentType (uk.gov.hmcts.probate.model.DocumentType)15 CaveatCallbackRequest (uk.gov.hmcts.probate.model.ccd.caveat.request.CaveatCallbackRequest)14 SolsAddress (uk.gov.hmcts.probate.model.ccd.raw.SolsAddress)14 DocumentLink (uk.gov.hmcts.probate.model.ccd.raw.DocumentLink)13 ArrayList (java.util.ArrayList)12 LetterV3 (uk.gov.hmcts.reform.sendletter.api.model.v3.LetterV3)12 ArgumentMatchers.anyString (org.mockito.ArgumentMatchers.anyString)10 CollectionMember (uk.gov.hmcts.probate.model.ccd.raw.CollectionMember)10 UUID (java.util.UUID)9