X-Git-Url: https://git.pterodactylus.net/?p=Sone.git;a=blobdiff_plain;f=src%2Ftest%2Fjava%2Fnet%2Fpterodactylus%2Fsone%2Ftext%2FFreenetLinkPartTest.java;h=1aff605e7d401cf66b234a586ea3e916acd643bb;hp=57284bf34cd082f71bd5aaeaa2300598b342da0b;hb=4273a6ebdde8c4f1092a6c5d4f62ad483f3eaa96;hpb=1d7e3aae6a6a885a7492eb445988a5437c63cb0d diff --git a/src/test/java/net/pterodactylus/sone/text/FreenetLinkPartTest.java b/src/test/java/net/pterodactylus/sone/text/FreenetLinkPartTest.java index 57284bf..1aff605 100644 --- a/src/test/java/net/pterodactylus/sone/text/FreenetLinkPartTest.java +++ b/src/test/java/net/pterodactylus/sone/text/FreenetLinkPartTest.java @@ -35,8 +35,33 @@ public class FreenetLinkPartTest { } @Test - public void textIsUsedAsTitleIfNoTextIsGiven() { - assertThat(new FreenetLinkPart("link", "text", true).getTitle(), is("text")); + public void linkIsUsedAsTitleIfNoTextIsGiven() { + assertThat(new FreenetLinkPart("link", "text", true).getTitle(), is("link")); + } + + @Test(expected = NullPointerException.class) + public void nullIsNotAllowedForLink() { + new FreenetLinkPart(null, "text", "title", true); + } + + @Test(expected = NullPointerException.class) + public void nullIsNotAllowedForText() { + new FreenetLinkPart("link", null, "title", true); + } + + @Test(expected = NullPointerException.class) + public void nullIsNotAllowedForLinkInSecondaryConstructor() { + new FreenetLinkPart(null, "text", true); + } + + @Test(expected = NullPointerException.class) + public void nullIsNotAllowedForTextInSecondaryConstructor() { + new FreenetLinkPart("link", null, true); + } + + @Test(expected = NullPointerException.class) + public void nullIsNotAllowedForTitle() { + new FreenetLinkPart("link", "text", null, true); } }