From: David ‘Bombe’ Roden Date: Wed, 5 Oct 2016 17:14:57 +0000 (+0200) Subject: Add test for LinkPart X-Git-Tag: 0.9.6^2~48 X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=93b429b1e24f353d6be1b6ae5f77cee6f3a26b27;p=Sone.git Add test for LinkPart --- 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 index 0000000..0059b09 --- /dev/null +++ b/src/test/java/net/pterodactylus/sone/text/LinkPartTest.java @@ -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 David ‘Bombe’ Roden + */ +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")); + } + +}