Search in sources :

Example 11 with Participant

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

the class ParticipantResourceTest method testUpdate404NotFoundError.

@Override
@Test
public void testUpdate404NotFoundError() throws Exception {
    roles.add("victim");
    Address address = new Address("", "", "123 First St", "San Jose", "CA", 94321, "Home");
    addresses.add(address);
    Participant participant = new Participant(1, "", "", "Marge", "Simpson", "Female", "111223333", "2017-01-11", 123, 456, roles, addresses);
    int receivedStatus = inMemoryResource.client().target(ROOT_RESOURCE).request().accept(MediaType.APPLICATION_JSON).put(Entity.entity(participant, MediaType.APPLICATION_JSON)).getStatus();
    int expectedStatus = 405;
    assertThat(receivedStatus, is(expectedStatus));
}
Also used : Address(gov.ca.cwds.rest.api.domain.Address) Participant(gov.ca.cwds.rest.api.domain.Participant) Test(org.junit.Test)

Example 12 with Participant

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

the class ReporterTest method streetNumberShouldBeParsedFromStreetAddress.

@Test
public void streetNumberShouldBeParsedFromStreetAddress() {
    String streetAddress = "1 main";
    gov.ca.cwds.rest.api.domain.Address address = new gov.ca.cwds.rest.api.domain.Address("legacy_source_table", "legacy_id", streetAddress, "city", "state", 12345, "type");
    Participant participant = new Participant(5L, "legacy_source_table", "legacy_client_id", "firstName", "lastName", "gender", "ssn", "date_of_birth", 7L, 8L, new HashSet(), new HashSet());
    Reporter reporter = Reporter.createWithDefaults("referralId", true, address, participant, "countyCode", new Short("0"));
    assertEquals("Street Number not parsed from street address", "1", reporter.getStreetNumber());
}
Also used : Participant(gov.ca.cwds.rest.api.domain.Participant) HashSet(java.util.HashSet) Test(org.junit.Test)

Example 13 with Participant

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

the class ReporterTest method streetNameShouldBeParsedFromStreetAddress.

@Test
public void streetNameShouldBeParsedFromStreetAddress() {
    String streetAddress = "1 main";
    gov.ca.cwds.rest.api.domain.Address address = new gov.ca.cwds.rest.api.domain.Address("legacy_source_table", "legacy_id", streetAddress, "city", "state", 12345, "type");
    Participant participant = new Participant(5L, "legacy_source_table", "legacy_client_id", "firstName", "lastName", "gender", "ssn", "date_of_birth", 7L, 8L, new HashSet(), new HashSet());
    Reporter reporter = Reporter.createWithDefaults("referralId", true, address, participant, "countyCode", new Short("0"));
    assertEquals("Street Number not parsed from street address", "main", reporter.getStreetName());
}
Also used : Participant(gov.ca.cwds.rest.api.domain.Participant) HashSet(java.util.HashSet) Test(org.junit.Test)

Example 14 with Participant

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

the class ReporterTest method createWithDefaultsShouldInitializeWithPassedInValues.

@Test
public void createWithDefaultsShouldInitializeWithPassedInValues() {
    String streetNumber = "1";
    String streetName = "main";
    String streetAddress = streetNumber + " " + streetName;
    String city = "sacramento";
    String state = "ca";
    Integer zipCode = 12345;
    String type = "type";
    gov.ca.cwds.rest.api.domain.Address address = new gov.ca.cwds.rest.api.domain.Address("legacy_source_table", "legacy_id", streetAddress, city, state, zipCode, type);
    String referralId = "referralId";
    boolean isMandatedReporter = true;
    String firstName = "firstName";
    String lastName = "lastName";
    Participant participant = new Participant(5L, "legacy_source_table", "legacy_client_id", firstName, lastName, "gender", "ssn", "date_of_birth", 7L, 8L, new HashSet(), new HashSet());
    String countyCode = "countyCode";
    Short stateCode = new Short("0");
    Reporter reporter = Reporter.createWithDefaults(referralId, isMandatedReporter, address, participant, countyCode, stateCode);
    assertEquals("Expected referralId field to have been initialized with value", referralId, reporter.getReferralId());
    assertEquals("Expected isMandatedReporter field to have been initialized with value", isMandatedReporter, reporter.getMandatedReporterIndicator());
    assertEquals("Expected streetNumer field to have been initialized with value", streetNumber, reporter.getStreetNumber());
    assertEquals("Expected street name field to have been initialized with value", streetName, reporter.getStreetName());
    assertEquals("Expected city field to have been initialized with value", city, reporter.getCityName());
    assertEquals("Expected zipCode field to have been initialized with value", zipCode.toString(), reporter.getZipcode());
    assertEquals("Expected firstName field to have been initialized with value", firstName, reporter.getFirstName());
    assertEquals("Expected last name field to have been initialized with value", lastName, reporter.getLastName());
    assertEquals("Expected countyCode field to have been initialized with value", countyCode, reporter.getCountySpecificCode());
    assertEquals("Expected stateCode field to have been initialized with value", stateCode, reporter.getStateCodeType());
}
Also used : Participant(gov.ca.cwds.rest.api.domain.Participant) HashSet(java.util.HashSet) Test(org.junit.Test)

Example 15 with Participant

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

the class ReporterTest method streetNameShouldContainSecondWordWhenOnlyNoStreetNumberIsPresent.

@Test
public void streetNameShouldContainSecondWordWhenOnlyNoStreetNumberIsPresent() {
    String streetAddress = "Main St";
    gov.ca.cwds.rest.api.domain.Address address = new gov.ca.cwds.rest.api.domain.Address("legacy_source_table", "legacy_id", streetAddress, "city", "state", 12345, "type");
    Participant participant = new Participant(5L, "legacy_source_table", "legacy_client_id", "firstName", "lastName", "gender", "ssn", "date_of_birth", 7L, 8L, new HashSet(), new HashSet());
    Reporter reporter = Reporter.createWithDefaults("referralId", true, address, participant, "countyCode", new Short("0"));
    assertEquals("Expected StreetName to contain second word as street name", "St", reporter.getStreetName());
}
Also used : Participant(gov.ca.cwds.rest.api.domain.Participant) HashSet(java.util.HashSet) Test(org.junit.Test)

Aggregations

Participant (gov.ca.cwds.rest.api.domain.Participant)18 Test (org.junit.Test)13 HashSet (java.util.HashSet)12 Address (gov.ca.cwds.rest.api.domain.Address)3 ImmutableSet (com.google.common.collect.ImmutableSet)1 Address (gov.ca.cwds.data.persistence.ns.Address)1 Screening (gov.ca.cwds.data.persistence.ns.Screening)1 Allegation (gov.ca.cwds.rest.api.domain.Allegation)1 CrossReport (gov.ca.cwds.rest.api.domain.CrossReport)1 Person (gov.ca.cwds.rest.api.domain.Person)1 PostedScreening (gov.ca.cwds.rest.api.domain.PostedScreening)1 PostedScreeningToReferral (gov.ca.cwds.rest.api.domain.PostedScreeningToReferral)1 ScreeningRequest (gov.ca.cwds.rest.api.domain.ScreeningRequest)1 ScreeningResponse (gov.ca.cwds.rest.api.domain.ScreeningResponse)1 ScreeningToReferral (gov.ca.cwds.rest.api.domain.ScreeningToReferral)1 ChildClient (gov.ca.cwds.rest.api.domain.cms.ChildClient)1 Client (gov.ca.cwds.rest.api.domain.cms.Client)1 PostedAllegation (gov.ca.cwds.rest.api.domain.cms.PostedAllegation)1 PostedClient (gov.ca.cwds.rest.api.domain.cms.PostedClient)1 ReferralClient (gov.ca.cwds.rest.api.domain.cms.ReferralClient)1