diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/main/java/com/juick/Message.java | 6 | ||||
-rw-r--r-- | src/main/java/com/juick/User.java | 24 | ||||
-rw-r--r-- | src/test/java/com/juick/tests/MessageTests.java | 18 |
3 files changed, 28 insertions, 20 deletions
diff --git a/src/main/java/com/juick/Message.java b/src/main/java/com/juick/Message.java index 1a690106..c128b4f2 100644 --- a/src/main/java/com/juick/Message.java +++ b/src/main/java/com/juick/Message.java @@ -80,6 +80,12 @@ public class Message implements Comparable { Recommendation = msg.Recommendation; } + public void parseTags(String strTags) { + if (strTags != null) { + Tags.addAll(Arrays.asList(strTags.split(" "))); + } + } + @Override public boolean equals(Object obj) { if (!(obj instanceof Message)) { diff --git a/src/main/java/com/juick/User.java b/src/main/java/com/juick/User.java index 13df2058..40a3df96 100644 --- a/src/main/java/com/juick/User.java +++ b/src/main/java/com/juick/User.java @@ -28,9 +28,9 @@ public class User { public Object Avatar = null; private String FullName = null; private String JID = null; - private int unreadCount; + public int MessagesCount = 0; private String AuthHash = null; - private boolean banned = false; + public boolean Banned = false; public User() { } @@ -41,9 +41,9 @@ public class User { Avatar = u.Avatar; setFullName(u.getFullName()); setJID(u.getJID()); - setUnreadCount(u.getUnreadCount()); + MessagesCount = u.MessagesCount; setAuthHash(u.getAuthHash()); - setBanned(u.isBanned()); + Banned = u.Banned; } @Override @@ -90,20 +90,4 @@ public class User { public void setAuthHash(String authHash) { AuthHash = authHash; } - - public int getUnreadCount() { - return unreadCount; - } - - public void setUnreadCount(int unreadCount) { - this.unreadCount = unreadCount; - } - - public boolean isBanned() { - return banned; - } - - public void setBanned(boolean banned) { - this.banned = banned; - } } diff --git a/src/test/java/com/juick/tests/MessageTests.java b/src/test/java/com/juick/tests/MessageTests.java new file mode 100644 index 00000000..0392c7b3 --- /dev/null +++ b/src/test/java/com/juick/tests/MessageTests.java @@ -0,0 +1,18 @@ +package com.juick.tests;
+
+import static org.junit.Assert.assertEquals;
+
+import org.junit.Test;
+
+import com.juick.Message;
+
+public class MessageTests {
+ @Test
+ public void messageTagsParser() {
+ Message msg = new Message();
+ msg.parseTags("test test" + (char)0xA0 + "2 test3");
+ assertEquals("First tag must be", "test", msg.Tags.get(0));
+ assertEquals("Third tag must be", "test3", msg.Tags.get(2));
+ assertEquals("Count of tags must be", 3, msg.Tags.size());
+ }
+}
\ No newline at end of file |