aboutsummaryrefslogtreecommitdiff
path: root/juick-api/src/test/java/com/juick/api
diff options
context:
space:
mode:
Diffstat (limited to 'juick-api/src/test/java/com/juick/api')
-rw-r--r--juick-api/src/test/java/com/juick/api/tests/MessagesTests.java14
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));