From: David ‘Bombe’ Roden Date: Wed, 5 Oct 2016 19:18:00 +0000 (+0200) Subject: Add test for SonePart X-Git-Tag: 0.9.6^2~38 X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=bfc3b2eaed7128e4a97e4f29a39cd41e2de6b7be;p=Sone.git Add test for SonePart --- diff --git a/src/test/java/net/pterodactylus/sone/text/SonePartTest.java b/src/test/java/net/pterodactylus/sone/text/SonePartTest.java new file mode 100644 index 0000000..6ca2858 --- /dev/null +++ b/src/test/java/net/pterodactylus/sone/text/SonePartTest.java @@ -0,0 +1,37 @@ +package net.pterodactylus.sone.text; + +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.Matchers.is; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; + +import net.pterodactylus.sone.data.Profile; +import net.pterodactylus.sone.data.Sone; + +import org.hamcrest.MatcherAssert; +import org.junit.Test; +import org.mockito.Mockito; + +/** + * Unit test for {@link SonePart}. + * + * @author David ‘Bombe’ Roden + */ +public class SonePartTest { + + private final Sone sone = mock(Sone.class); + private final SonePart part = new SonePart(sone); + + @Test + public void soneIsRetainedCorrectly() { + assertThat(part.getSone(), is(sone)); + } + + @Test + public void textIsConstructedFromSonesNiceName() { + when(sone.getProfile()).thenReturn(mock(Profile.class)); + when(sone.getName()).thenReturn("sone"); + assertThat(part.getText(), is("sone")); + } + +}