Add test for LinkPart
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Wed, 5 Oct 2016 17:14:57 +0000 (19:14 +0200)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Wed, 5 Oct 2016 17:14:57 +0000 (19:14 +0200)
src/test/java/net/pterodactylus/sone/text/LinkPartTest.java [new file with mode: 0644]

diff --git a/src/test/java/net/pterodactylus/sone/text/LinkPartTest.java b/src/test/java/net/pterodactylus/sone/text/LinkPartTest.java
new file mode 100644 (file)
index 0000000..0059b09
--- /dev/null
@@ -0,0 +1,37 @@
+package net.pterodactylus.sone.text;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.is;
+
+import org.junit.Test;
+
+/**
+ * Unit test for {@link LinkPart}.
+ *
+ * @author <a href="mailto:bombe@pterodactylus.net">David ‘Bombe’ Roden</a>
+ */
+public class LinkPartTest {
+
+       private final LinkPart part = new LinkPart("link", "text", "title");
+
+       @Test
+       public void linkIsRetainedCorrectly() {
+               assertThat(part.getLink(), is("link"));
+       }
+
+       @Test
+       public void textIsRetainedCorrectly() {
+               assertThat(part.getText(), is("text"));
+       }
+
+       @Test
+       public void titleIsRetainedCorrectly() {
+               assertThat(part.getTitle(), is("title"));
+       }
+
+       @Test
+       public void textIsUsedAsTitleIfNoTitleIsGiven() {
+               assertThat(new LinkPart("link", "text").getTitle(), is("text"));
+       }
+
+}