From bfc3b2eaed7128e4a97e4f29a39cd41e2de6b7be Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Wed, 5 Oct 2016 21:18:00 +0200 Subject: [PATCH] Add test for SonePart --- .../net/pterodactylus/sone/text/SonePartTest.java | 37 ++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 src/test/java/net/pterodactylus/sone/text/SonePartTest.java 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")); + } + +} -- 2.7.4