From: David ‘Bombe’ Roden Date: Sat, 9 Nov 2013 14:08:39 +0000 (+0100) Subject: Add tests for isFreenetLink() and isPlainText(). X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=696f2b9f710796f4929bdcae02b865baade4e990;p=Sone.git Add tests for isFreenetLink() and isPlainText(). --- diff --git a/src/test/java/net/pterodactylus/sone/text/FreenetLinkPartTest.java b/src/test/java/net/pterodactylus/sone/text/FreenetLinkPartTest.java index b227625..5384f94 100644 --- a/src/test/java/net/pterodactylus/sone/text/FreenetLinkPartTest.java +++ b/src/test/java/net/pterodactylus/sone/text/FreenetLinkPartTest.java @@ -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)); diff --git a/src/test/java/net/pterodactylus/sone/text/LinkPartTest.java b/src/test/java/net/pterodactylus/sone/text/LinkPartTest.java index 65c3461..cee6910 100644 --- a/src/test/java/net/pterodactylus/sone/text/LinkPartTest.java +++ b/src/test/java/net/pterodactylus/sone/text/LinkPartTest.java @@ -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")); diff --git a/src/test/java/net/pterodactylus/sone/text/PartContainerTest.java b/src/test/java/net/pterodactylus/sone/text/PartContainerTest.java index 93c99d6..b249fe0 100644 --- a/src/test/java/net/pterodactylus/sone/text/PartContainerTest.java +++ b/src/test/java/net/pterodactylus/sone/text/PartContainerTest.java @@ -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!"))); } diff --git a/src/test/java/net/pterodactylus/sone/text/PlainTextPartTest.java b/src/test/java/net/pterodactylus/sone/text/PlainTextPartTest.java index c810b52..a715746 100644 --- a/src/test/java/net/pterodactylus/sone/text/PlainTextPartTest.java +++ b/src/test/java/net/pterodactylus/sone/text/PlainTextPartTest.java @@ -34,6 +34,16 @@ public class PlainTextPartTest { private final PlainTextPart plainTextPart = new PlainTextPart(""); @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("")); } diff --git a/src/test/java/net/pterodactylus/sone/text/PostPartTest.java b/src/test/java/net/pterodactylus/sone/text/PostPartTest.java index e26f524..2dcc946 100644 --- a/src/test/java/net/pterodactylus/sone/text/PostPartTest.java +++ b/src/test/java/net/pterodactylus/sone/text/PostPartTest.java @@ -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)); } diff --git a/src/test/java/net/pterodactylus/sone/text/SonePartTest.java b/src/test/java/net/pterodactylus/sone/text/SonePartTest.java index 931646b..fe2fe06 100644 --- a/src/test/java/net/pterodactylus/sone/text/SonePartTest.java +++ b/src/test/java/net/pterodactylus/sone/text/SonePartTest.java @@ -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)); }