From 93b429b1e24f353d6be1b6ae5f77cee6f3a26b27 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Wed, 5 Oct 2016 19:14:57 +0200 Subject: [PATCH] Add test for LinkPart --- .../net/pterodactylus/sone/text/LinkPartTest.java | 37 ++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 src/test/java/net/pterodactylus/sone/text/LinkPartTest.java 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")); + } + +} -- 2.7.4