Add filter for linked images
[Sone.git] / src / test / java / net / pterodactylus / sone / text / LinkPartTest.java
index 0059b09..62648a1 100644 (file)
@@ -30,8 +30,33 @@ public class LinkPartTest {
        }
 
        @Test
-       public void textIsUsedAsTitleIfNoTitleIsGiven() {
-               assertThat(new LinkPart("link", "text").getTitle(), is("text"));
+       public void linkIsUsedAsTitleIfNoTitleIsGiven() {
+               assertThat(new LinkPart("link", "text").getTitle(), is("link"));
+       }
+
+       @Test(expected = NullPointerException.class)
+       public void nullIsNotAllowedForLink() {
+               new LinkPart(null, "text", "title");
+       }
+
+       @Test(expected = NullPointerException.class)
+       public void nullIsNotAllowedForText() {
+               new LinkPart("link", null, "title");
+       }
+
+       @Test(expected = NullPointerException.class)
+       public void nullIsNotAllowedForLinkInSecondaryConstructor() {
+               new LinkPart(null, "text");
+       }
+
+       @Test(expected = NullPointerException.class)
+       public void nullIsNotAllowedForTextInSecondaryConstructor() {
+               new LinkPart("link", null);
+       }
+
+       @Test(expected = NullPointerException.class)
+       public void nullIsNotAllowedForTitle() {
+               new LinkPart("link", "text", null);
        }
 
 }