Search in sources :

Example 6 with PostedLongText

use of gov.ca.cwds.rest.api.domain.cms.PostedLongText in project API by ca-cwds.

the class LongTextServiceTest method testCreateReturnsCorrectEntity.

@Override
@Test
public void testCreateReturnsCorrectEntity() throws Exception {
    String id = "AaoDyiJq27";
    LongText longTextDomain = MAPPER.readValue(fixture("fixtures/domain/legacy/LongText/valid/valid.json"), LongText.class);
    gov.ca.cwds.data.persistence.cms.LongText toCreate = new gov.ca.cwds.data.persistence.cms.LongText(id, longTextDomain, "q27");
    LongText request = new LongText(toCreate);
    when(longTextDao.create(any(gov.ca.cwds.data.persistence.cms.LongText.class))).thenReturn(toCreate);
    PostedLongText expected = new PostedLongText(toCreate);
    PostedLongText returned = longTextService.create(request);
    assertThat(returned, is(expected));
}
Also used : PostedLongText(gov.ca.cwds.rest.api.domain.cms.PostedLongText) LongText(gov.ca.cwds.rest.api.domain.cms.LongText) PostedLongText(gov.ca.cwds.rest.api.domain.cms.PostedLongText) Test(org.junit.Test)

Example 7 with PostedLongText

use of gov.ca.cwds.rest.api.domain.cms.PostedLongText in project API by ca-cwds.

the class ScreeningToReferralService method createLongText.

private String createLongText(String countySpecificCode, String textDescription, Set<ErrorMessage> messages) throws ServiceException {
    LongText longText = new LongText(countySpecificCode, textDescription);
    PostedLongText postedLongText = longTextService.create(longText);
    buildErrors(messages, validator.validate(longText));
    return postedLongText.getId();
}
Also used : LongText(gov.ca.cwds.rest.api.domain.cms.LongText) PostedLongText(gov.ca.cwds.rest.api.domain.cms.PostedLongText) PostedLongText(gov.ca.cwds.rest.api.domain.cms.PostedLongText)

Aggregations

PostedLongText (gov.ca.cwds.rest.api.domain.cms.PostedLongText)7 LongText (gov.ca.cwds.rest.api.domain.cms.LongText)6 Test (org.junit.Test)5 ServiceException (gov.ca.cwds.rest.services.ServiceException)3 LongText (gov.ca.cwds.data.persistence.cms.LongText)1 EntityExistsException (javax.persistence.EntityExistsException)1 InvocationOnMock (org.mockito.invocation.InvocationOnMock)1