From 86c15ac320f9757524fffd99d88dbfcae8a84217 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Wed, 4 Nov 2015 13:40:17 +0300 Subject: add unit tests --- build.gradle | 4 ++++ src/test/java/com/juick/tests/MessageTests.java | 16 ++++++++++++++++ 2 files changed, 20 insertions(+) create mode 100644 src/test/java/com/juick/tests/MessageTests.java diff --git a/build.gradle b/build.gradle index 405a81af..c973749c 100644 --- a/build.gradle +++ b/build.gradle @@ -1 +1,5 @@ apply plugin: "java" + +dependencies { + testCompile 'junit:junit:4.12' +} 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..47b2d13c --- /dev/null +++ b/src/test/java/com/juick/tests/MessageTests.java @@ -0,0 +1,16 @@ +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 -- cgit v1.2.3