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));
}
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());
}
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());
}
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());
}
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());
}
Aggregations