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.Profile;
9 import net.pterodactylus.sone.data.Sone;
11 import org.hamcrest.MatcherAssert;
12 import org.junit.Test;
13 import org.mockito.Mockito;
16 * Unit test for {@link SonePart}.
18 * @author <a href="mailto:bombe@pterodactylus.net">David ‘Bombe’ Roden</a>
20 public class SonePartTest {
22 private final Sone sone = mock(Sone.class);
23 private final SonePart part = new SonePart(sone);
26 public void soneIsRetainedCorrectly() {
27 assertThat(part.getSone(), is(sone));
31 public void textIsConstructedFromSonesNiceName() {
32 when(sone.getProfile()).thenReturn(mock(Profile.class));
33 when(sone.getName()).thenReturn("sone");
34 assertThat(part.getText(), is("sone"));
37 @Test(expected = NullPointerException.class)
38 public void nullIsNotAllowedForSone() {