[R4] Avoid DataIntegrityViolationException for crm field
This commit is contained in:
parent
aa86a53458
commit
2632cee84d
@ -73,7 +73,7 @@ public class DoctorControllerTest {
|
|||||||
@DisplayName("Should post valid doctor and return http status ok")
|
@DisplayName("Should post valid doctor and return http status ok")
|
||||||
public void testPostValidDoctor() throws Exception {
|
public void testPostValidDoctor() throws Exception {
|
||||||
|
|
||||||
DoctorDTO doctorDTO = new DoctorDTO("test", "test@gmail.com", "123456", "99999999", Specialty.ORTHOPEDICS,
|
DoctorDTO doctorDTO = new DoctorDTO("test", "test@gmail.com", "101010", "99999999", Specialty.ORTHOPEDICS,
|
||||||
new AddressDTO("TEST STREET", "NEIGHBORHOOD", "12345678", "CITY", "ST", null, null));
|
new AddressDTO("TEST STREET", "NEIGHBORHOOD", "12345678", "CITY", "ST", null, null));
|
||||||
|
|
||||||
String doctorDTOContent = mapper.writeValueAsString(doctorDTO);
|
String doctorDTOContent = mapper.writeValueAsString(doctorDTO);
|
||||||
@ -90,7 +90,7 @@ public class DoctorControllerTest {
|
|||||||
@DisplayName("Should not post invalid doctor and return http status bad request")
|
@DisplayName("Should not post invalid doctor and return http status bad request")
|
||||||
public void testPostInvalidDoctor() throws Exception {
|
public void testPostInvalidDoctor() throws Exception {
|
||||||
|
|
||||||
DoctorDTO doctorDTO = new DoctorDTO("", "test@gmail.com", "123456", "99999999", Specialty.ORTHOPEDICS,
|
DoctorDTO doctorDTO = new DoctorDTO("", "test@gmail.com", "111111", "99999999", Specialty.ORTHOPEDICS,
|
||||||
new AddressDTO("TEST STREET", "NEIGHBORHOOD", "12345678", "CITY", "ST", null, null));
|
new AddressDTO("TEST STREET", "NEIGHBORHOOD", "12345678", "CITY", "ST", null, null));
|
||||||
|
|
||||||
String doctorDTOContent = mapper.writeValueAsString(doctorDTO);
|
String doctorDTOContent = mapper.writeValueAsString(doctorDTO);
|
||||||
|
|||||||
@ -76,7 +76,7 @@ public class DoctorServiceTest {
|
|||||||
@Test
|
@Test
|
||||||
@DisplayName("Should add valid doctor")
|
@DisplayName("Should add valid doctor")
|
||||||
public void testAddValidDoctor() throws Exception {
|
public void testAddValidDoctor() throws Exception {
|
||||||
DoctorDTO doctorDTO = new DoctorDTO("test", "test@gmail.com", "123456", "99999999", Specialty.ORTHOPEDICS,
|
DoctorDTO doctorDTO = new DoctorDTO("test", "test@gmail.com", "101010", "99999999", Specialty.ORTHOPEDICS,
|
||||||
new AddressDTO("TEST STREET", "NEIGHBORHOOD", "12345678", "CITY", "ST", null, null));
|
new AddressDTO("TEST STREET", "NEIGHBORHOOD", "12345678", "CITY", "ST", null, null));
|
||||||
|
|
||||||
Doctor doctor = doctorService.addDoctor(doctorDTO);
|
Doctor doctor = doctorService.addDoctor(doctorDTO);
|
||||||
@ -90,7 +90,7 @@ public class DoctorServiceTest {
|
|||||||
@Test
|
@Test
|
||||||
@DisplayName("Should not add doctor with invalid parameter")
|
@DisplayName("Should not add doctor with invalid parameter")
|
||||||
public void testAddInvalidDoctor() throws Exception {
|
public void testAddInvalidDoctor() throws Exception {
|
||||||
DoctorDTO doctorDTO = new DoctorDTO("", "test@gmail.com", "123456", "99999999", Specialty.ORTHOPEDICS,
|
DoctorDTO doctorDTO = new DoctorDTO("", "test@gmail.com", "111111", "99999999", Specialty.ORTHOPEDICS,
|
||||||
new AddressDTO("TEST STREET", "NEIGHBORHOOD", "12345678", "CITY", "ST", null, null));
|
new AddressDTO("TEST STREET", "NEIGHBORHOOD", "12345678", "CITY", "ST", null, null));
|
||||||
|
|
||||||
assertThrows(ConstraintViolationException.class, () -> doctorService.addDoctor(doctorDTO));
|
assertThrows(ConstraintViolationException.class, () -> doctorService.addDoctor(doctorDTO));
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user