|
|
|
@ -31,20 +31,15 @@ public class LocationTest { |
|
|
|
|
String lname = "test_add_location_name"; |
|
|
|
|
String ladress = "test_add_location_adress"; |
|
|
|
|
Location location = new Location(lname, ladress); |
|
|
|
|
|
|
|
|
|
int size = locationRepository.getSize(); |
|
|
|
|
|
|
|
|
|
locationRepository.addLocation(location); |
|
|
|
|
|
|
|
|
|
int newsize = locationRepository.getSize(); |
|
|
|
|
|
|
|
|
|
assertEquals(newsize, size + 1); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
|
@Order(2) |
|
|
|
|
void testUpdateLocation() { |
|
|
|
|
|
|
|
|
|
// creo nuovo menìmbro dello staff
|
|
|
|
|
String firstname1 = "test_update_location_name1"; |
|
|
|
|
String lastname1 = "test_update_location_lastname1"; |
|
|
|
@ -87,29 +82,21 @@ public class LocationTest { |
|
|
|
|
location.ifPresent(a -> { |
|
|
|
|
assertEquals(a.getName(), newlname); |
|
|
|
|
assertEquals(a.getAdress(), newladress); |
|
|
|
|
assertEquals(a.getStaffs(), staffs); |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
|
@Order(3) |
|
|
|
|
void testDeleteLocation() { |
|
|
|
|
|
|
|
|
|
String lname = "test_delete_location_name"; |
|
|
|
|
String ladress = "test_delete_location_adress"; |
|
|
|
|
Location location = new Location(lname, ladress); |
|
|
|
|
locationRepository.addLocation(location); |
|
|
|
|
|
|
|
|
|
Location removeLocation = locationRepository.searchLocationByName(lname); |
|
|
|
|
|
|
|
|
|
long ID = removeLocation.getId(); |
|
|
|
|
|
|
|
|
|
int size = locationRepository.getSize(); |
|
|
|
|
|
|
|
|
|
locationRepository.deleteLocationById(ID); |
|
|
|
|
|
|
|
|
|
int newsize = locationRepository.getSize(); |
|
|
|
|
|
|
|
|
|
assertEquals(newsize, size - 1); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|