diff options
Diffstat (limited to 'src/test')
-rw-r--r-- | src/test/java/com/juick/tests/ApiTests.java | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/test/java/com/juick/tests/ApiTests.java b/src/test/java/com/juick/tests/ApiTests.java index 727447e0..1d777d62 100644 --- a/src/test/java/com/juick/tests/ApiTests.java +++ b/src/test/java/com/juick/tests/ApiTests.java @@ -11,6 +11,7 @@ import com.juick.server.MessagesQueries; import com.juick.server.SubscriptionsQueries; import com.juick.server.TagQueries; import com.juick.server.UserQueries; +import com.juick.server.helpers.TagStats; import com.juick.server.protocol.JuickProtocol; import com.juick.server.protocol.ProtocolReply; import com.juick.www.PageTemplates; @@ -26,6 +27,7 @@ import java.lang.reflect.InvocationTargetException; import java.text.ParseException; import java.util.ArrayList; import java.util.Calendar; +import java.util.Collections; import java.util.List; import static org.junit.Assert.assertEquals; @@ -93,11 +95,13 @@ public class ApiTests { MessagesQueries.deleteMessage(jdbc, user_id, mid2); String htmlTagName = ">_<"; Tag htmlTag = TagQueries.getTag(jdbc, htmlTagName, true); + TagStats htmlTagStats = new TagStats(); + htmlTagStats.setTag(htmlTag); String dbTagName = jdbc.queryForObject("select name from tags where name=?", String.class, StringEscapeUtils.escapeHtml4(htmlTagName)); assertNotEquals("db tags should be escaped", dbTagName, htmlTag.getName()); assertEquals("object tags should unescaped", htmlTag.getName(), StringEscapeUtils.unescapeHtml4(dbTagName)); assertEquals("template should encode escaped tag in url and show escaped tag in name", - "<a href=\"/tag/%3E_%3C\" rel=\"nofollow\">>_<</a>", PageTemplates.formatTags(new ArrayList<Tag>() {{ add(htmlTag); }} )); + "<a href=\"/tag/%3E_%3C\" rel=\"nofollow\">>_<</a>", PageTemplates.formatTags(Collections.singletonList(htmlTagStats))); } @Test @@ -115,7 +119,7 @@ public class ApiTests { assertEquals("text should match", "yoyo", MessagesQueries.getMessage(jdbc, mid).getText()); assertEquals("tag should match", "yo", - MessagesQueries.getMessageTags(jdbc, mid).get(0).getName()); + MessagesQueries.getMessageTags(jdbc, mid).get(0).getTag().getName()); assertNotEquals("should not be error", "Error", protocol.getReply(user, "#" + mid).getDescription()); assertEquals("should be PONG", "PONG", protocol.getReply(user, " ping \n ").getDescription()); int readerUid = UserQueries.createUser(jdbc, "dummyReader", "dummySecret"); |