|
|
@ -26,14 +26,14 @@ public class StaffTest { |
|
|
|
@Order(1) |
|
|
|
@Order(1) |
|
|
|
void testAddStaff() { |
|
|
|
void testAddStaff() { |
|
|
|
|
|
|
|
|
|
|
|
String firstname = "Ivan"; |
|
|
|
String firstname = "test_add_staff_name"; |
|
|
|
String lastname = "Donati"; |
|
|
|
String lastname = "test_add_staff_lastname"; |
|
|
|
String city = "Milano"; |
|
|
|
String city = "test_add_staff_city"; |
|
|
|
String idka = "lihwelhqluchwlir8"; |
|
|
|
String idka = "test_add_staff_idka"; |
|
|
|
String ruolo = "frontoffice"; |
|
|
|
String ruolo = "test_add_staff_role"; |
|
|
|
|
|
|
|
|
|
|
|
String lname = "Library bria 2"; |
|
|
|
String lname = "test_add_staff_loc_name"; |
|
|
|
String ladress = "via chissa dove"; |
|
|
|
String ladress = "test_add_staff_loc_adress"; |
|
|
|
Location location = new Location(lname, ladress); |
|
|
|
Location location = new Location(lname, ladress); |
|
|
|
locationRepository.addLocation(location); |
|
|
|
locationRepository.addLocation(location); |
|
|
|
|
|
|
|
|
|
|
@ -55,13 +55,13 @@ public class StaffTest { |
|
|
|
void testUpdateStaff() { |
|
|
|
void testUpdateStaff() { |
|
|
|
|
|
|
|
|
|
|
|
// creo una locazione
|
|
|
|
// creo una locazione
|
|
|
|
String lname = "Library cosa 2"; |
|
|
|
String lname = "test_update_staff_loc_name"; |
|
|
|
String ladress = "via chissa dove"; |
|
|
|
String ladress = "test_update_staff_loc_adress"; |
|
|
|
Location location = new Location(lname, ladress); |
|
|
|
Location location = new Location(lname, ladress); |
|
|
|
|
|
|
|
|
|
|
|
// creo una seconda locazione
|
|
|
|
// creo una seconda locazione
|
|
|
|
String newlName = "Library destra 5"; |
|
|
|
String newlName = "test_update_staff_loc_newname"; |
|
|
|
String newlAdress = "via prossima stella"; |
|
|
|
String newlAdress = "test_update_staff_loc_newname"; |
|
|
|
Location newlocation = new Location(newlName, newlAdress); |
|
|
|
Location newlocation = new Location(newlName, newlAdress); |
|
|
|
|
|
|
|
|
|
|
|
int losize = locationRepository.getSize(); |
|
|
|
int losize = locationRepository.getSize(); |
|
|
@ -74,11 +74,12 @@ public class StaffTest { |
|
|
|
assertEquals(newlosize, losize + 2); // ci sono 2 locazioni aggunte
|
|
|
|
assertEquals(newlosize, losize + 2); // ci sono 2 locazioni aggunte
|
|
|
|
|
|
|
|
|
|
|
|
// creo un membro dello staff
|
|
|
|
// creo un membro dello staff
|
|
|
|
String firstname = "Maccio"; |
|
|
|
String firstname = "test_update_staff_name"; |
|
|
|
String lastname = "Donati"; |
|
|
|
String lastname = "test_update_staff_lastname"; |
|
|
|
String city = "Milano"; |
|
|
|
String city = "test_update_staff_city"; |
|
|
|
String idka = "lihwelhqluchwlir8"; |
|
|
|
String idka = "test_update_staff_idka"; |
|
|
|
String ruolo = "frontoffice"; |
|
|
|
String ruolo = "test_update_staff_role"; |
|
|
|
|
|
|
|
|
|
|
|
Staff newstaff = new Staff(firstname, lastname, city, idka, ruolo); |
|
|
|
Staff newstaff = new Staff(firstname, lastname, city, idka, ruolo); |
|
|
|
|
|
|
|
|
|
|
|
int size = staffRepository.getSize(); |
|
|
|
int size = staffRepository.getSize(); |
|
|
@ -92,11 +93,11 @@ public class StaffTest { |
|
|
|
Staff editStaff = staffRepository.searchStaffByidka(idka); |
|
|
|
Staff editStaff = staffRepository.searchStaffByidka(idka); |
|
|
|
|
|
|
|
|
|
|
|
long id = editStaff.getId(); |
|
|
|
long id = editStaff.getId(); |
|
|
|
String newfirstname = "Ivans"; |
|
|
|
String newfirstname = "test_update_staff_newname"; |
|
|
|
String newlastname = "Donatis"; |
|
|
|
String newlastname = "test_update_staff_newlastname"; |
|
|
|
String newcity = "Milanos"; |
|
|
|
String newcity = "test_update_staff_newcity"; |
|
|
|
String newidka = "lihwelhkluchwlir5"; |
|
|
|
String newidka = "test_update_staff_newidka"; |
|
|
|
String newruolo = "spazzino"; |
|
|
|
String newruolo = "test_update_staff_newrole"; |
|
|
|
|
|
|
|
|
|
|
|
staffRepository.updateStaff(id, newfirstname, newlastname, newcity, newidka, newruolo, newlocation); |
|
|
|
staffRepository.updateStaff(id, newfirstname, newlastname, newcity, newidka, newruolo, newlocation); |
|
|
|
|
|
|
|
|
|
|
@ -117,14 +118,14 @@ public class StaffTest { |
|
|
|
@Order(3) |
|
|
|
@Order(3) |
|
|
|
void testDeleteStaff() { |
|
|
|
void testDeleteStaff() { |
|
|
|
|
|
|
|
|
|
|
|
String firstname = "John"; |
|
|
|
String firstname = "test_delete_staff_name"; |
|
|
|
String lastname = "Donati"; |
|
|
|
String lastname = "test_delete_staff_lastname"; |
|
|
|
String city = "Milano"; |
|
|
|
String city = "test_delete_staff_city"; |
|
|
|
String idka = "lihwelhsfghhwlir8"; |
|
|
|
String idka = "test_delete_staff_idka"; |
|
|
|
String ruolo = "manager"; |
|
|
|
String ruolo = "test_delete_staff_role"; |
|
|
|
|
|
|
|
|
|
|
|
String lname = "Library siniz 2"; |
|
|
|
String lname = "test_delete_staff_loc_name"; |
|
|
|
String ladress = "via sassa dove"; |
|
|
|
String ladress = "test_delete_staff_loc_adress"; |
|
|
|
Location location = new Location(lname, ladress); |
|
|
|
Location location = new Location(lname, ladress); |
|
|
|
locationRepository.addLocation(location); |
|
|
|
locationRepository.addLocation(location); |
|
|
|
|
|
|
|
|
|
|
|