From c003198aa10f81adc902e8de61462e7d0957b214 Mon Sep 17 00:00:00 2001 From: Filip Izydorczyk Date: Sat, 24 Oct 2020 16:43:42 +0200 Subject: [PATCH] Fixed old tests --- .../com/plannaplan/services/UserServiceTest.java | 9 ++------- .../plannaplan/controllers/ConfigControllerTest.java | 12 +----------- 2 files changed, 3 insertions(+), 18 deletions(-) diff --git a/buisnesslogic/src/test/java/com/plannaplan/services/UserServiceTest.java b/buisnesslogic/src/test/java/com/plannaplan/services/UserServiceTest.java index 951c1b2..15a7b59 100755 --- a/buisnesslogic/src/test/java/com/plannaplan/services/UserServiceTest.java +++ b/buisnesslogic/src/test/java/com/plannaplan/services/UserServiceTest.java @@ -11,7 +11,6 @@ import com.plannaplan.entities.User; import com.plannaplan.exceptions.UserNotFoundException; import com.plannaplan.types.UserRoles; -import org.junit.Before; import org.junit.Test; import org.junit.jupiter.api.TestMethodOrder; import org.junit.jupiter.api.MethodOrderer.OrderAnnotation; @@ -29,14 +28,10 @@ public class UserServiceTest { @Autowired private UserService userService; - @Before - public void initialize() { - User testUser = new User(TEST_USER_NAME, TEST_USER_SUERNAME, TEST_USER_MAIL, UserRoles.TEST_USER); - this.userService.save(testUser); - } - @Test public void shouldReturnToken() { + final User testUser = new User(TEST_USER_NAME, TEST_USER_SUERNAME, TEST_USER_MAIL, UserRoles.TEST_USER); + this.userService.save(testUser); try { final String token = this.userService.login(TEST_USER_MAIL); System.out.println("Returned token: " + token); diff --git a/restservice/src/test/java/com/plannaplan/controllers/ConfigControllerTest.java b/restservice/src/test/java/com/plannaplan/controllers/ConfigControllerTest.java index 6fbab62..1c322c8 100755 --- a/restservice/src/test/java/com/plannaplan/controllers/ConfigControllerTest.java +++ b/restservice/src/test/java/com/plannaplan/controllers/ConfigControllerTest.java @@ -37,16 +37,6 @@ public class ConfigControllerTest { @Autowired private UserService service; - @Test - public void shouldReturnOK() throws Exception { - final InputStream inputStream = getClass().getClassLoader().getResourceAsStream(FILE_NAME); - final MockMultipartFile file = new MockMultipartFile("file", inputStream); - - MockMvc mockMvc = MockMvcBuilders.webAppContextSetup(webApplicationContext).build(); - mockMvc.perform(multipart(CONFIG_ENDPOINT).file(file)).andExpect(status().isOk()); - - } - @Test public void shouldReturnNoAuthorized() throws Exception { final InputStream inputStream = getClass().getClassLoader().getResourceAsStream(FILE_NAME); @@ -59,7 +49,7 @@ public class ConfigControllerTest { @Test public void shouldReturnOKAuthorized() throws Exception { - final User usr = new User(null, null, TEST_MAIL, UserRoles.TEST_USER); + final User usr = new User(null, null, TEST_MAIL, UserRoles.ADMIN); this.service.save(usr); final InputStream inputStream = getClass().getClassLoader().getResourceAsStream(FILE_NAME);