1 package net.pterodactylus.sone.text;
3 import static org.hamcrest.MatcherAssert.assertThat;
4 import static org.hamcrest.Matchers.is;
5 import static org.mockito.Mockito.mock;
6 import static org.mockito.Mockito.when;
8 import net.pterodactylus.sone.data.Post;
10 import org.junit.Test;
13 * Unit test for {@link PostPart}.
15 public class PostPartTest {
17 private final Post post = mock(Post.class);
18 private final PostPart part = new PostPart(post);
21 public void postIsRetainedCorrectly() {
22 assertThat(part.getPost(), is(post));
26 public void textIsTakenFromPost() {
27 when(post.getText()).thenReturn("text");
28 assertThat(part.getText(), is("text"));
31 @Test(expected = NullPointerException.class)
32 public void nullIsNotAllowedForPost() {