aboutsummaryrefslogtreecommitdiff
path: root/juick-server/src/test/java/com
diff options
context:
space:
mode:
Diffstat (limited to 'juick-server/src/test/java/com')
-rw-r--r--juick-server/src/test/java/com/juick/server/tests/ServerTests.java14
1 files changed, 7 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 d3e7b7a5..abdabf4e 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
@@ -256,7 +256,7 @@ public class ServerTests {
@Test
public void messageTests() {
int user_id = userService.createUser("mmmme", "secret");
- User user = userService.getUserByUID(user_id).orElse(new User());
+ User user = userService.getUserByUID(user_id).orElse(AnonymousUser.INSTANCE);
assertEquals("it should be me", "mmmme", user.getName());
int mid = messagesService.createMessage(user_id, "yo", null, new ArrayList<>());
Message msg = messagesService.getMessage(mid);
@@ -273,7 +273,7 @@ public class ServerTests {
assertEquals(1, msg2.getTags().size());
assertEquals("we already have ugnich", -1, userService.createUser("ugnich", "x"));
int ugnich_id = userService.createUser("hugnich", "x");
- User ugnich = userService.getUserByUID(ugnich_id).orElse(new User());
+ User ugnich = userService.getUserByUID(ugnich_id).orElse(AnonymousUser.INSTANCE);
int rid = messagesService.createReply(msg2.getMid(), 0, ugnich, "bla-bla", null);
assertEquals(1, rid);
assertThat(msg2.getTo(), equalTo(null));
@@ -659,16 +659,16 @@ public class ServerTests {
@Test
public void botCommandsTests() throws Exception {
URI emptyUri = URI.create(StringUtils.EMPTY);
- assertThat(commandsManager.processCommand(new User(), "PING", emptyUri).getText(), is("PONG"));
+ assertThat(commandsManager.processCommand(AnonymousUser.INSTANCE, "PING", emptyUri).getText(), is("PONG"));
// subscription commands have two lines, others have 1
- assertThat(commandsManager.processCommand(new User(), "help", emptyUri).getText().split("\n").length, is(32));
+ assertThat(commandsManager.processCommand(AnonymousUser.INSTANCE, "help", emptyUri).getText().split("\n").length, is(32));
}
@Test
public void protocolTests() throws Exception {
URI emptyUri = URI.create(StringUtils.EMPTY);
int uid = userService.createUser("me", "secret");
- User user = userService.getUserByUID(uid).orElse(new User());
+ User user = userService.getUserByUID(uid).orElse(AnonymousUser.INSTANCE);
Tag yo = tagService.getTag("yo", true);
Message msg = commandsManager.processCommand(user, "*yo yoyo", URI.create("http://static.juick.com/settings/facebook.png")).getNewMessage().get();
assertThat(msg.getAttachmentType(), is("png"));
@@ -687,7 +687,7 @@ public class ServerTests {
assertEquals("should be message", true,
commandsManager.processCommand(user, String.format("#%d", mid), emptyUri).getText().startsWith("@me"));
int readerUid = userService.createUser("dummyReader", "dummySecret");
- User readerUser = userService.getUserByUID(readerUid).orElse(new User());
+ User readerUser = userService.getUserByUID(readerUid).orElse(AnonymousUser.INSTANCE);
assertThat(commandsManager.processCommand(readerUser, "s", emptyUri).getText().startsWith("You are subscribed to"), is(true));
assertThat(commandsManager.processCommand(readerUser, "S", emptyUri).getText().startsWith("You are subscribed to"), is(true));
assertEquals("should be subscribed", "Subscribed",
@@ -747,7 +747,7 @@ public class ServerTests {
assertEquals("number of tags should match", 1,
tagService.getMessageTags(mid).size());
int taggerUid = userService.createUser("dummyTagger", "dummySecret");
- User taggerUser = userService.getUserByUID(taggerUid).orElse(new User());
+ User taggerUser = userService.getUserByUID(taggerUid).orElse(AnonymousUser.INSTANCE);
assertEquals("should be subscribed", "Subscribed",
commandsManager.processCommand(taggerUser, "S *yo", emptyUri).getText());
assertEquals("number of subscribed users should match", 2,