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