diff options
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)); |