diff options
author | Vitaly Takmazov | 2017-05-12 16:53:50 +0300 |
---|---|---|
committer | Vitaly Takmazov | 2017-05-12 16:53:50 +0300 |
commit | 5789f0321eca329bec9afdb8923f323cb6702f52 (patch) | |
tree | 15e2224280ea86b079cbcfadd43e7f8eb0b36206 | |
parent | 161ef8c74547f8400d8264a1ab39d9c0c2240235 (diff) |
fix tests configurations
-rw-r--r-- | juick-api/src/test/java/com/juick/api/tests/MessagesTests.java | 15 | ||||
-rw-r--r-- | src/test/java/com/juick/tests/ApiTests.java | 6 |
2 files changed, 20 insertions, 1 deletions
diff --git a/juick-api/src/test/java/com/juick/api/tests/MessagesTests.java b/juick-api/src/test/java/com/juick/api/tests/MessagesTests.java index af1e49a4..a892656b 100644 --- a/juick-api/src/test/java/com/juick/api/tests/MessagesTests.java +++ b/juick-api/src/test/java/com/juick/api/tests/MessagesTests.java @@ -3,6 +3,7 @@ package com.juick.api.tests; import com.juick.Message; import com.juick.Tag; import com.juick.User; +import com.juick.api.TGBot; import com.juick.api.configuration.ApiMvcConfiguration; import com.juick.api.configuration.ApiSecurityConfig; import com.juick.api.configuration.MessengerConfiguration; @@ -16,6 +17,8 @@ import com.juick.tests.util.MockUtils; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; +import org.mockito.Mockito; +import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Import; import org.springframework.http.MediaType; @@ -26,6 +29,7 @@ import org.springframework.test.context.web.WebAppConfiguration; import org.springframework.test.web.servlet.MockMvc; import org.springframework.test.web.servlet.setup.MockMvcBuilders; import org.springframework.web.context.WebApplicationContext; +import org.springframework.web.socket.client.WebSocketConnectionManager; import javax.inject.Inject; import java.util.*; @@ -47,7 +51,16 @@ public class MessagesTests { @Configuration @Import(value = {ApiMvcConfiguration.class, ApiSecurityConfig.class, MockDataConfiguration.class, MessengerConfiguration.class, TelegramConfiguration.class}) - static class Config {} + static class Config { + @Bean + WebSocketConnectionManager connectionManager() { + return Mockito.mock(WebSocketConnectionManager.class); + } + @Bean + TGBot tgBot() { + return Mockito.mock(TGBot.class); + } + } private MockMvc mockMvc; @Inject diff --git a/src/test/java/com/juick/tests/ApiTests.java b/src/test/java/com/juick/tests/ApiTests.java index 529abd6c..778cc7af 100644 --- a/src/test/java/com/juick/tests/ApiTests.java +++ b/src/test/java/com/juick/tests/ApiTests.java @@ -21,6 +21,7 @@ import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Mock; +import org.mockito.Mockito; import org.mockito.MockitoAnnotations; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.ComponentScan; @@ -32,6 +33,7 @@ import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import org.springframework.transaction.PlatformTransactionManager; import org.springframework.transaction.annotation.TransactionManagementConfigurer; +import ru.sape.Sape; import javax.inject.Inject; import java.lang.reflect.InvocationTargetException; @@ -114,6 +116,10 @@ public class ApiTests { public JuickProtocol juickProtocol() { return new JuickProtocol("http://localhost:8080/"); } + @Bean + public Sape sape() { + return Mockito.mock(Sape.class); + } } @Inject |