Fix problem with admin test - cleaning database

Signed-off-by: Marcin Woźniak <y0rune@aol.com>
This commit is contained in:
Marcin Woźniak 2020-12-23 14:06:02 +01:00
parent da46582fc0
commit e647698591
Signed by: y0rune
GPG Key ID: F204C385F57EB348

View File

@ -2,6 +2,8 @@ package com.plannaplan.services;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.annotation.DirtiesContext;
import org.springframework.test.annotation.DirtiesContext.MethodMode;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringRunner;
@ -108,10 +110,9 @@ public class UserServiceTest {
assertTrue(userService.adminExists());
}
@Test
/**
* In future can fail the test due to create a admin user in the another tests.
*/
@DirtiesContext(methodMode = MethodMode.BEFORE_METHOD)
public void shouldReturnNotAdminExists() {
final String email = "shouldReturnNotAdminExists@UserService.test";
this.userService.save(new User("StudentTom", "Smieszny", email, UserRoles.STUDENT));