From a0616f4a298ada333c680e607bc0e0923c554233 Mon Sep 17 00:00:00 2001 From: meliurwen Date: Mon, 13 Jan 2020 01:16:24 +0100 Subject: [PATCH] Pulizia --- mivan/src/test/java/mivan/AuthorTest.java | 18 +----------------- mivan/src/test/java/mivan/LocationTest.java | 13 ------------- 2 files changed, 1 insertion(+), 30 deletions(-) diff --git a/mivan/src/test/java/mivan/AuthorTest.java b/mivan/src/test/java/mivan/AuthorTest.java index f5599d0..b9c3329 100644 --- a/mivan/src/test/java/mivan/AuthorTest.java +++ b/mivan/src/test/java/mivan/AuthorTest.java @@ -21,30 +21,20 @@ public class AuthorTest { @Test @Order(1) void testAddAuthor() { - String name = "Ivan"; - Author author = new Author(name); - authorRepository.addAuthor(author); - int size = authorRepository.getSize(); - assertEquals(size, 1); } @Test @Order(2) void testUpdateAuthor() { - String name = "Ivan"; - Author author = new Author(name); - authorRepository.addAuthor(author); - String updatedName = "Javoso"; - authorRepository.updateAuthor(author.getId(), updatedName); Optional updated_author = authorRepository.findById(author.getId()); updated_author.ifPresent(a -> { @@ -55,20 +45,14 @@ public class AuthorTest { @Test @Order(3) - void testDeleteUser() { + void testDeleteAuthor() { int size = authorRepository.getSize(); String name = "gollum"; - Author author = new Author(name); - authorRepository.addAuthor(author); - Author editAuthor = authorRepository.searchAuthorByName(name); - long ID = editAuthor.getId(); - authorRepository.deleteAuthorById(ID); - int end_size = authorRepository.getSize(); assertEquals(end_size, size); } diff --git a/mivan/src/test/java/mivan/LocationTest.java b/mivan/src/test/java/mivan/LocationTest.java index 77b0f92..ff73e63 100644 --- a/mivan/src/test/java/mivan/LocationTest.java +++ b/mivan/src/test/java/mivan/LocationTest.java @@ -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); }