Replace Fetched with Kotlin version
[Sone.git] / src / test / java / net / pterodactylus / sone / text / PostPartTest.java
1 package net.pterodactylus.sone.text;
2
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;
7
8 import net.pterodactylus.sone.data.Post;
9
10 import org.junit.Test;
11
12 /**
13  * Unit test for {@link PostPart}.
14  *
15  * @author <a href="mailto:bombe@pterodactylus.net">David ‘Bombe’ Roden</a>
16  */
17 public class PostPartTest {
18
19         private final Post post = mock(Post.class);
20         private final PostPart part = new PostPart(post);
21
22         @Test
23         public void postIsRetainedCorrectly() {
24                 assertThat(part.getPost(), is(post));
25         }
26
27         @Test
28         public void textIsTakenFromPost() {
29                 when(post.getText()).thenReturn("text");
30                 assertThat(part.getText(), is("text"));
31         }
32
33         @Test(expected = NullPointerException.class)
34         public void nullIsNotAllowedForPost() {
35             new PostPart(null);
36         }
37
38 }