From 696f2b9f710796f4929bdcae02b865baade4e990 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Sat, 9 Nov 2013 15:08:39 +0100 Subject: [PATCH] Add tests for isFreenetLink() and isPlainText(). --- .../net/pterodactylus/sone/text/FreenetLinkPartTest.java | 12 ++++++++++++ src/test/java/net/pterodactylus/sone/text/LinkPartTest.java | 12 ++++++++++++ .../java/net/pterodactylus/sone/text/PartContainerTest.java | 10 ++++++++++ .../java/net/pterodactylus/sone/text/PlainTextPartTest.java | 10 ++++++++++ src/test/java/net/pterodactylus/sone/text/PostPartTest.java | 10 ++++++++++ src/test/java/net/pterodactylus/sone/text/SonePartTest.java | 10 ++++++++++ 6 files changed, 64 insertions(+) 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)); } -- 2.7.4