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 * @author <a href="mailto:bombe@pterodactylus.net">David ‘Bombe’ Roden</a>
17 public class PostPartTest {
19 private final Post post = mock(Post.class);
20 private final PostPart part = new PostPart(post);
23 public void postIsRetainedCorrectly() {
24 assertThat(part.getPost(), is(post));
28 public void textIsTakenFromPost() {
29 when(post.getText()).thenReturn("text");
30 assertThat(part.getText(), is("text"));
33 @Test(expected = NullPointerException.class)
34 public void nullIsNotAllowedForPost() {