Search in sources :

Example 6 with Allegation

use of gov.ca.cwds.data.persistence.cms.Allegation in project API by ca-cwds.

the class AllegationDaoIT method testCreate.

/**
   * Create JUnit test
   */
@Override
@Test
public void testCreate() throws Exception {
    gov.ca.cwds.rest.api.domain.cms.Allegation vda = validDomainAllegation();
    Allegation allegation = new Allegation("1234567ABC", DomainChef.uncookDateString(vda.getAbuseEndDate()), DomainChef.uncookDateString(vda.getAbuseStartDate()), vda.getAbuseFrequency(), vda.getAbuseFrequencyPeriodCode(), vda.getAbuseLocationDescription(), vda.getAllegationDispositionType(), vda.getAllegationType(), vda.getDispositionDescription(), DomainChef.uncookDateString(vda.getDispositionDate()), DomainChef.cookBoolean(vda.getInjuryHarmDetailIndicator()), vda.getNonProtectingParentCode(), DomainChef.cookBoolean(vda.getStaffPersonAddedIndicator()), vda.getVictimClientId(), vda.getPerpetratorClientId(), vda.getReferralId(), vda.getCountySpecificCode(), DomainChef.cookBoolean(vda.getZippyCreatedIndicator()), vda.getPlacementFacilityType(), null, null);
    Allegation create = allegationDao.create(allegation);
    assertThat(allegation, is(create));
}
Also used : Allegation(gov.ca.cwds.data.persistence.cms.Allegation) Test(org.junit.Test)

Example 7 with Allegation

use of gov.ca.cwds.data.persistence.cms.Allegation in project API by ca-cwds.

the class AllegationDaoIT method testFind.

/**
   * Find JUnit test
   */
@Override
@Test
public void testFind() throws Exception {
    Allegation found = allegationDao.find(id);
    assertThat(found.getId(), is(equalTo(id)));
}
Also used : Allegation(gov.ca.cwds.data.persistence.cms.Allegation) Test(org.junit.Test)

Example 8 with Allegation

use of gov.ca.cwds.data.persistence.cms.Allegation in project API by ca-cwds.

the class AllegationDaoIT method testDelete.

/**
   * Delete JUnit test
   */
@Override
@Test
public void testDelete() throws Exception {
    Allegation deleted = allegationDao.delete(id);
    assertThat(deleted.getId(), is(id));
}
Also used : Allegation(gov.ca.cwds.data.persistence.cms.Allegation) Test(org.junit.Test)

Example 9 with Allegation

use of gov.ca.cwds.data.persistence.cms.Allegation in project API by ca-cwds.

the class AllegationDaoIT method testUpdate.

@Override
@Test
public void testUpdate() throws Exception {
    gov.ca.cwds.rest.api.domain.cms.Allegation vda = validDomainAllegation();
    Allegation allegation = new Allegation(id, DomainChef.uncookDateString(vda.getAbuseEndDate()), DomainChef.uncookDateString(vda.getAbuseStartDate()), vda.getAbuseFrequency(), vda.getAbuseFrequencyPeriodCode(), vda.getAbuseLocationDescription(), vda.getAllegationDispositionType(), vda.getAllegationType(), vda.getDispositionDescription(), DomainChef.uncookDateString(vda.getDispositionDate()), DomainChef.cookBoolean(vda.getInjuryHarmDetailIndicator()), vda.getNonProtectingParentCode(), DomainChef.cookBoolean(vda.getStaffPersonAddedIndicator()), vda.getVictimClientId(), vda.getPerpetratorClientId(), vda.getReferralId(), vda.getCountySpecificCode(), DomainChef.cookBoolean(vda.getZippyCreatedIndicator()), vda.getPlacementFacilityType(), null, null);
    Allegation updated = allegationDao.update(allegation);
    assertThat(allegation, is(updated));
}
Also used : Allegation(gov.ca.cwds.data.persistence.cms.Allegation) Test(org.junit.Test)

Example 10 with Allegation

use of gov.ca.cwds.data.persistence.cms.Allegation in project API by ca-cwds.

the class AllegationDaoIT method testCreateExistingEntityException.

@Override
@Test
public void testCreateExistingEntityException() throws Exception {
    thrown.expect(EntityExistsException.class);
    gov.ca.cwds.rest.api.domain.cms.Allegation vda = validDomainAllegation();
    Allegation allegation = new Allegation(id, DomainChef.uncookDateString(vda.getAbuseEndDate()), DomainChef.uncookDateString(vda.getAbuseStartDate()), vda.getAbuseFrequency(), vda.getAbuseFrequencyPeriodCode(), vda.getAbuseLocationDescription(), vda.getAllegationDispositionType(), vda.getAllegationType(), vda.getDispositionDescription(), DomainChef.uncookDateString(vda.getDispositionDate()), DomainChef.cookBoolean(vda.getInjuryHarmDetailIndicator()), vda.getNonProtectingParentCode(), DomainChef.cookBoolean(vda.getStaffPersonAddedIndicator()), vda.getVictimClientId(), vda.getPerpetratorClientId(), vda.getReferralId(), vda.getCountySpecificCode(), DomainChef.cookBoolean(vda.getZippyCreatedIndicator()), vda.getPlacementFacilityType(), null, null);
    allegationDao.create(allegation);
}
Also used : Allegation(gov.ca.cwds.data.persistence.cms.Allegation) Test(org.junit.Test)

Aggregations

Allegation (gov.ca.cwds.data.persistence.cms.Allegation)10 Test (org.junit.Test)8 PostedAllegation (gov.ca.cwds.rest.api.domain.cms.PostedAllegation)2 ServiceException (gov.ca.cwds.rest.services.ServiceException)2 EntityExistsException (javax.persistence.EntityExistsException)1 EntityNotFoundException (javax.persistence.EntityNotFoundException)1