Don’t use deprecated class anymore
[Sone.git] / src / test / java / net / pterodactylus / sone / text / SonePartTest.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.Profile;
9 import net.pterodactylus.sone.data.Sone;
10
11 import org.hamcrest.MatcherAssert;
12 import org.junit.Test;
13 import org.mockito.Mockito;
14
15 /**
16  * Unit test for {@link SonePart}.
17  *
18  * @author <a href="mailto:bombe@pterodactylus.net">David ‘Bombe’ Roden</a>
19  */
20 public class SonePartTest {
21
22         private final Sone sone = mock(Sone.class);
23         private final SonePart part = new SonePart(sone);
24
25         @Test
26         public void soneIsRetainedCorrectly() {
27             assertThat(part.getSone(), is(sone));
28         }
29
30         @Test
31         public void textIsConstructedFromSonesNiceName() {
32             when(sone.getProfile()).thenReturn(mock(Profile.class));
33                 when(sone.getName()).thenReturn("sone");
34                 assertThat(part.getText(), is("sone"));
35         }
36
37         @Test(expected = NullPointerException.class)
38         public void nullIsNotAllowedForSone() {
39             new SonePart(null);
40         }
41
42 }