From ef9bb70fa1fe3744e971837eb78c6c004cd1e989 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Thu, 15 Mar 2018 23:24:13 +0300 Subject: boot: simplify test configuration --- juick-www/src/test/java/com/juick/www/WebAppTests.java | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) (limited to 'juick-www/src') diff --git a/juick-www/src/test/java/com/juick/www/WebAppTests.java b/juick-www/src/test/java/com/juick/www/WebAppTests.java index 73cec17a..7aa0a515 100644 --- a/juick-www/src/test/java/com/juick/www/WebAppTests.java +++ b/juick-www/src/test/java/com/juick/www/WebAppTests.java @@ -27,7 +27,6 @@ import com.juick.Message; import com.juick.Tag; import com.juick.User; import com.juick.configuration.DataConfiguration; -import com.juick.configuration.RepositoryConfiguration; import com.juick.service.*; import com.juick.util.MessageUtils; import com.juick.www.configuration.SapeConfiguration; @@ -44,9 +43,9 @@ import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Value; -import org.springframework.boot.test.autoconfigure.web.client.AutoConfigureWebClient; import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc; import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.mock.mockito.MockBean; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.core.io.ClassPathResource; @@ -80,7 +79,6 @@ import java.util.stream.StreamSupport; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.*; -import static org.springframework.security.test.web.servlet.setup.SecurityMockMvcConfigurers.springSecurity; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*; @@ -95,17 +93,11 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers. @ContextConfiguration(classes = { DataConfiguration.class, WwwServletConfiguration.class, WwwAppConfiguration.class, SapeConfiguration.class, - RepositoryConfiguration.class, WebSecurityConfig.class + WebSecurityConfig.class }) public class WebAppTests { - @Configuration - static class Config { - @Bean - public ImagesService imagesService() { - return new MockImagesService(); - } - } - + @MockBean + private ImagesService imagesService; @Inject private WebApp webApp; -- cgit v1.2.3