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