cleanup work

This commit is contained in:
eugenp 2016-12-18 22:13:53 +02:00
parent e84137bdfc
commit 51a96d14de
3 changed files with 80 additions and 76 deletions

View File

@ -20,7 +20,7 @@ import org.springframework.test.context.junit4.SpringRunner;
@SuppressWarnings("unused")
@RunWith(SpringRunner.class)
@SpringBootTest(classes = ServerLocationApp.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
public class ServerLocationAppTests {
public class ServerLocationAppIntegrationTest {
ConfigurableApplicationContext application2;
ConfigurableApplicationContext application3;

View File

@ -7,9 +7,9 @@ import org.baeldung.config.PersistenceConfig;
import org.baeldung.config.SecurityConfig;
import org.baeldung.persistence.dao.UserRepository;
import org.baeldung.persistence.model.User;
import org.junit.After;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.After;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.SpringApplicationConfiguration;
import org.springframework.security.authentication.AuthenticationProvider;
@ -23,7 +23,7 @@ import org.springframework.test.context.web.WebAppConfiguration;
@RunWith(SpringJUnit4ClassRunner.class)
@SpringApplicationConfiguration(classes = { MvcConfig.class, SecurityConfig.class, PersistenceConfig.class })
@WebAppConfiguration
public class CustomUserDetailsServiceTest {
public class CustomUserDetailsServiceIntegrationTest {
public static final String USERNAME = "user";
public static final String PASSWORD = "pass";
@ -38,6 +38,8 @@ public class CustomUserDetailsServiceTest {
@Autowired
PasswordEncoder passwordEncoder;
//
@Test
public void givenExistingUser_whenAuthenticate_thenRetrieveFromDb() {
User user = new User();
@ -64,6 +66,8 @@ public class CustomUserDetailsServiceTest {
authenticationProvider.authenticate(auth);
}
//
@After
public void tearDown() {
myUserRepository.removeUserByUsername(USERNAME);