use of io.undertree.symptom.domain.GivenName in project spring-boot-jpa by ssherwood.
the class PatientControllerWebTests method test_PatientController_addPatient_WithEmptyGivenName_Expect_BadRequest.
@Test
public void test_PatientController_addPatient_WithEmptyGivenName_Expect_BadRequest() throws Exception {
Patient build = new TestPatientBuilder().withGivenName(new GivenName("")).build();
ResponseEntity<String> json = restTemplate.postForEntity("/patients", build, String.class);
assertThat(json.getStatusCode()).isEqualTo(HttpStatus.BAD_REQUEST);
JSONAssert.assertEquals("{exception:\"org.springframework.web.bind.MethodArgumentNotValidException\"}", json.getBody(), false);
}
use of io.undertree.symptom.domain.GivenName in project spring-boot-jpa by ssherwood.
the class PatientRepositoryTests method test_PatientRepository_SaveWithShortGivenName_ExpectException.
@Test
public void test_PatientRepository_SaveWithShortGivenName_ExpectException() throws Exception {
thrown.expect(ConstraintViolationException.class);
thrown.expectMessage(allOf(containsString("givenName"), containsString("'size must be between 2 and")));
patientRepository.saveAndFlush(new TestPatientBuilder().withGivenName(new GivenName("A")).build());
}
use of io.undertree.symptom.domain.GivenName in project spring-boot-jpa by ssherwood.
the class PatientRepositoryTests method test_PatientRepository_SaveWithEmptyGivenName_ExpectException.
@Test
public void test_PatientRepository_SaveWithEmptyGivenName_ExpectException() throws Exception {
thrown.expect(ConstraintViolationException.class);
thrown.expectMessage(allOf(containsString("givenName.givenName"), containsString("'The given name should only contain alphanumeric values.'")));
thrown.expectMessage(allOf(containsString("givenName.givenName"), containsString("'size must be between 2 and 50'")));
patientRepository.saveAndFlush(new TestPatientBuilder().withGivenName(new GivenName("")).build());
}
Aggregations