From: David ‘Bombe’ Roden Date: Wed, 5 Oct 2016 19:12:21 +0000 (+0200) Subject: Add test for PostPart X-Git-Tag: 0.9.6^2~40 X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=133960ca34d2ec746802bb8bd83235e50d308310;p=Sone.git Add test for PostPart --- diff --git a/src/test/java/net/pterodactylus/sone/text/PostPartTest.java b/src/test/java/net/pterodactylus/sone/text/PostPartTest.java new file mode 100644 index 0000000..6666d61 --- /dev/null +++ b/src/test/java/net/pterodactylus/sone/text/PostPartTest.java @@ -0,0 +1,33 @@ +package net.pterodactylus.sone.text; + +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.Matchers.is; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; + +import net.pterodactylus.sone.data.Post; + +import org.junit.Test; + +/** + * Unit test for {@link PostPart}. + * + * @author David ‘Bombe’ Roden + */ +public class PostPartTest { + + private final Post post = mock(Post.class); + private final PostPart part = new PostPart(post); + + @Test + public void postIsRetainedCorrectly() { + assertThat(part.getPost(), is(post)); + } + + @Test + public void textIsTakenFromPost() { + when(post.getText()).thenReturn("text"); + assertThat(part.getText(), is("text")); + } + +}