aboutsummaryrefslogtreecommitdiff
path: root/juick-server/src/test/java/com/juick/server
diff options
context:
space:
mode:
Diffstat (limited to 'juick-server/src/test/java/com/juick/server')
-rw-r--r--juick-server/src/test/java/com/juick/server/tests/ServerTests.java18
1 files changed, 11 insertions, 7 deletions
diff --git a/juick-server/src/test/java/com/juick/server/tests/ServerTests.java b/juick-server/src/test/java/com/juick/server/tests/ServerTests.java
index a30403b0..0ef82f98 100644
--- a/juick-server/src/test/java/com/juick/server/tests/ServerTests.java
+++ b/juick-server/src/test/java/com/juick/server/tests/ServerTests.java
@@ -28,6 +28,7 @@ import com.juick.server.EmailManager;
import com.juick.server.XMPPConnection;
import com.juick.server.XMPPServer;
import com.juick.server.helpers.AnonymousUser;
+import com.juick.server.helpers.CommandResult;
import com.juick.server.helpers.TagStats;
import com.juick.server.util.HttpUtils;
import com.juick.service.*;
@@ -551,17 +552,20 @@ public class ServerTests {
int uid = userService.createUser("me", "secret");
User user = userService.getUserByUID(uid).orElse(new User());
Tag yo = tagService.getTag("yo", true);
- Message msg = commandsManager.processCommand(user, Jid.of("test@localhost"), "*yo yoyo", URI.create("http://static.juick.com/settings/facebook.png")).getNewMessage();
+ Message msg = commandsManager.processCommand(user, Jid.of("test@localhost"), "*yo yoyo", URI.create("http://static.juick.com/settings/facebook.png")).getNewMessage().get();
assertThat(msg.getAttachmentType(), is("png"));
- Message msgreply = commandsManager.processCommand(user, Jid.of("test@localhost"), "#" + msg.getMid() + " yyy", HttpUtils.downloadImage(URI.create("http://static.juick.com/settings/xmpp.png").toURL(), tmpDir)).getNewMessage();
+ Message msgreply = commandsManager.processCommand(user, Jid.of("test@localhost"), "#" + msg.getMid() + " yyy", HttpUtils.downloadImage(URI.create("http://static.juick.com/settings/xmpp.png").toURL(), tmpDir)).getNewMessage().get();
assertThat(msgreply.getAttachmentType(), equalTo("png"));
- int mid = messagesService.createMessage(uid, "yoyo", null, Collections.singletonList(yo));
- assertEquals("should be message", true,
- commandsManager.processCommand(user, Jid.of("test@localhost"), String.format("#%d", mid), emptyUri).getText().startsWith("@me"));
assertEquals("text should match", "yoyo",
- messagesService.getMessage(mid).getText());
+ messagesService.getMessage(msg.getMid()).getText());
assertEquals("tag should match", "yo",
- tagService.getMessageTags(mid).get(0).getTag().getName());
+ tagService.getMessageTags(msg.getMid()).get(0).getTag().getName());
+ CommandResult yoyoMsg = commandsManager.processCommand(user, null, "*yo", URI.create("http://static.juick.com/settings/facebook.png"));
+ assertTrue(yoyoMsg.getNewMessage().isPresent());
+ assertThat(yoyoMsg.getNewMessage().get().getTags().get(0), is(yo));
+ int mid = yoyoMsg.getNewMessage().get().getMid();
+ assertEquals("should be message", true,
+ commandsManager.processCommand(user, Jid.of("test@localhost"), String.format("#%d", mid), emptyUri).getText().startsWith("@me"));
int readerUid = userService.createUser("dummyReader", "dummySecret");
User readerUser = userService.getUserByUID(readerUid).orElse(new User());
Jid dummyJid = Jid.of("dummy@localhost");