diff options
author | Vitaly Takmazov | 2018-01-12 11:34:43 +0300 |
---|---|---|
committer | Vitaly Takmazov | 2018-01-12 11:34:43 +0300 |
commit | 40b392f1d63f6aaa8794beaff4c0432dd29f1858 (patch) | |
tree | 96bec459d88522124196d9d8ca92e677b48d2da8 /juick-api/src/test/java/com/juick/api/tests | |
parent | 59d08c3fe59077238e7f7774be359a7966ed522c (diff) |
refactoring and tests fixes
Diffstat (limited to 'juick-api/src/test/java/com/juick/api/tests')
-rw-r--r-- | juick-api/src/test/java/com/juick/api/tests/MessagesTests.java | 14 |
1 files changed, 5 insertions, 9 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 a270a120..fff7e02c 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 @@ -23,6 +23,7 @@ import com.juick.ExternalToken; import com.juick.Message; import com.juick.Tag; import com.juick.User; +import com.juick.api.EmailManager; import com.juick.api.configuration.ApiAppConfiguration; import com.juick.api.configuration.ApiSecurityConfig; import com.juick.configuration.RepositoryConfiguration; @@ -299,22 +300,17 @@ public class MessagesTests extends AbstractJUnit4SpringContextTests { IntStream.rangeClosed(6, 12).forEach(i -> { messagesService.createReply(topmid, 0, i, "yo", null); }); - mockMvc.perform(get("/messages/top_candidates").with(httpBasic(juickName, juickPassword)) - .contentType(MediaType.APPLICATION_JSON_UTF8)) - .andExpect(status().isOk()) - .andExpect(jsonPath("$[0]", is(topmid))); + + assertThat(messagesService.getPopularCandidates().get(0), is(topmid)); Tag juickTag = tagService.getTag(juickTagId); assertThat(juickTag.TID, is(2)); tagService.updateTags(topmid, Collections.singletonList(juickTag)); - mockMvc.perform(get("/messages/top_candidates").with(httpBasic(juickName, juickPassword)) - .contentType(MediaType.APPLICATION_JSON_UTF8)) - .andExpect(status().isOk()) - .andExpect(jsonPath("$", hasSize(0))); + assertThat(messagesService.getPopularCandidates().isEmpty(), is(true)); } @Test public void inReplyToScannerTest() { String header = "<123456.56@juick.com>"; - Scanner headerScanner = new Scanner(header).useDelimiter("\\.|@|<"); + Scanner headerScanner = new Scanner(header).useDelimiter(EmailManager.MSGID_PATTERN); int mid = Integer.parseInt(headerScanner.next()); int rid = Integer.parseInt(headerScanner.next()); assertThat(mid, equalTo(123456)); |