Add tests for isFreenetLink() and isPlainText().
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Sat, 9 Nov 2013 14:08:39 +0000 (15:08 +0100)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Fri, 28 Feb 2014 21:25:57 +0000 (22:25 +0100)
src/test/java/net/pterodactylus/sone/text/FreenetLinkPartTest.java
src/test/java/net/pterodactylus/sone/text/LinkPartTest.java
src/test/java/net/pterodactylus/sone/text/PartContainerTest.java
src/test/java/net/pterodactylus/sone/text/PlainTextPartTest.java
src/test/java/net/pterodactylus/sone/text/PostPartTest.java
src/test/java/net/pterodactylus/sone/text/SonePartTest.java

index b227625..5384f94 100644 (file)
@@ -32,6 +32,18 @@ import org.junit.Test;
 public class FreenetLinkPartTest {
 
        @Test
+       public void freenetLinkPartIsNotAPlainTextPart() {
+               FreenetLinkPart freenetLinkPart = new FreenetLinkPart("link", "text", true);
+               assertThat(freenetLinkPart.isPlainText(), is(false));
+       }
+
+       @Test
+       public void freenetLinkPartIsAFreenetLink() {
+               FreenetLinkPart freenetLinkPart = new FreenetLinkPart("link", "text", true);
+               assertThat(freenetLinkPart.isFreenetLink(), is(true));
+       }
+
+       @Test
        public void trustedAttributeIsStoredAndReturnedWhenSet() {
                FreenetLinkPart freenetLinkPart = new FreenetLinkPart("link", "text", true);
                assertThat(freenetLinkPart.isTrusted(), is(true));
index 65c3461..cee6910 100644 (file)
@@ -34,6 +34,18 @@ import org.junit.Test;
 public class LinkPartTest {
 
        @Test
+       public void linkPartIsNotAPlainTextPart() {
+               LinkPart linkPart = new LinkPart("http://li.nk/link.html", "link.html");
+               assertThat(linkPart.isPlainText(), is(false));
+       }
+
+       @Test
+       public void linkPartIsNotAFreenetLink() {
+               LinkPart linkPart = new LinkPart("http://li.nk/link.html", "link.html");
+               assertThat(linkPart.isFreenetLink(), is(false));
+       }
+
+       @Test
        public void linkPartWithoutTitleGetsTextAsTitle() {
                LinkPart linkPart = new LinkPart("http://li.nk/link.html", "link.html");
                assertThat(linkPart.getLink(), is("http://li.nk/link.html"));
index 93c99d6..b249fe0 100644 (file)
@@ -46,6 +46,16 @@ public class PartContainerTest {
        }
 
        @Test
+       public void partContainerIsNotAPlainTextPart() {
+               assertThat(partContainer.isPlainText(), is(false));
+       }
+
+       @Test
+       public void partContainerIsNotAFreenetLink() {
+               assertThat(partContainer.isFreenetLink(), is(false));
+       }
+
+       @Test
        public void partContainerCanReturnContainedParts() {
                assertThat(partContainer, contains(matchesPart("Test!"), matchesPart(" More Test!")));
        }
index c810b52..a715746 100644 (file)
@@ -34,6 +34,16 @@ public class PlainTextPartTest {
        private final PlainTextPart plainTextPart = new PlainTextPart("<plain-text>");
 
        @Test
+       public void plainTextPartIsAPlainTextPart() {
+               assertThat(plainTextPart.isPlainText(), is(true));
+       }
+
+       @Test
+       public void plainTextPartIsNotAFreenetLink() {
+               assertThat(plainTextPart.isFreenetLink(), is(false));
+       }
+
+       @Test
        public void plainTextPartCanStoreAndReturnText() {
                assertThat(plainTextPart.getText(), is("<plain-text>"));
        }
index e26f524..2dcc946 100644 (file)
@@ -40,6 +40,16 @@ public class PostPartTest {
        private final PostPart postPart = new PostPart(post);
 
        @Test
+       public void postPartIsNotAPlainTextPart() {
+               assertThat(postPart.isPlainText(), is(false));
+       }
+
+       @Test
+       public void postPartIsNotAFreenetLink() {
+               assertThat(postPart.isFreenetLink(), is(false));
+       }
+
+       @Test
        public void postPartCanStoreAndReturnPost() {
                assertThat(postPart.getPost(), is(post));
        }
index 931646b..fe2fe06 100644 (file)
@@ -39,6 +39,16 @@ public class SonePartTest {
        private final SonePart sonePart = new SonePart(sone);
 
        @Test
+       public void sonePartIsNotAPlainTextPart() {
+               assertThat(sonePart.isPlainText(), is(false));
+       }
+
+       @Test
+       public void sonePartIsNotAFreenetLink() {
+               assertThat(sonePart.isFreenetLink(), is(false));
+       }
+
+       @Test
        public void sonePartCanStoreAndReturnSone() {
                assertThat(sonePart.getSone(), is(sone));
        }