diff options
author | Alexander Alexeev | 2016-11-26 04:35:28 +0700 |
---|---|---|
committer | Alexander Alexeev | 2016-11-26 04:35:28 +0700 |
commit | 8948fecade6f82e3853868e6edadbf343c04968f (patch) | |
tree | b04638f9953c6aa9c3d2b641816d3d5517cb7796 /juick-api/src/test/java/com | |
parent | 91a07facc6e4417810cebbfe017a4ac167ac13b1 (diff) |
messages controller improvenments; test corrected
Diffstat (limited to 'juick-api/src/test/java/com')
-rw-r--r-- | juick-api/src/test/java/com/juick/api/tests/MessagesTests.java | 14 |
1 files changed, 8 insertions, 6 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 1dec4b7c..fd233a03 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 @@ -6,6 +6,7 @@ import com.juick.User; import com.juick.api.configuration.ApiAppConfiguration; import com.juick.api.configuration.ApiMvcConfiguration; import com.juick.api.configuration.ApiSecurityConfig; +import com.juick.configuration.DataConfiguration; import com.juick.service.MessagesService; import com.juick.service.UserService; import org.junit.Before; @@ -43,7 +44,7 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers. @WebAppConfiguration public class MessagesTests { @Configuration - @Import(value={ApiMvcConfiguration.class, ApiAppConfiguration.class, ApiSecurityConfig.class}) + @Import(value={ApiMvcConfiguration.class, ApiAppConfiguration.class, ApiSecurityConfig.class, DataConfiguration.class}) static class Config { @Bean @Primary @@ -59,12 +60,12 @@ public class MessagesTests { private MockMvc mockMvc; @Inject - WebApplicationContext webApplicationContext; + private WebApplicationContext webApplicationContext; @Inject - MessagesService messagesService; + private MessagesService messagesService; @Inject - UserService userService; + private UserService userService; @Before public void setUp() { @@ -86,8 +87,9 @@ public class MessagesTests { msg.setTags(Collections.singletonList(new Tag("yo"))); mockMvc.perform(get("/home")) .andExpect(status().is4xxClientError()); - when(userService.getUIDByHttpAuth(null)) - .thenReturn(1); + + when(userService.getUserByName(null)) + .thenReturn(user); when(messagesService.getMyFeed(1, 0)) .thenReturn(Collections.singletonList(1)); |