X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Ftest%2Fjava%2Fnet%2Fpterodactylus%2Fsone%2Ffcp%2FUnlockSoneCommandTest.java;h=adb6b96d9b7fdad50a1789e4cec9350b82c0e168;hb=2d37242d19f2e726cd402b99f935a0eba282f630;hp=05fc73c5f36381e52896f822998f697f46d227b2;hpb=f65328fb92d16e568b869bf5f2771dd4114d8abc;p=Sone.git diff --git a/src/test/java/net/pterodactylus/sone/fcp/UnlockSoneCommandTest.java b/src/test/java/net/pterodactylus/sone/fcp/UnlockSoneCommandTest.java index 05fc73c..adb6b96 100644 --- a/src/test/java/net/pterodactylus/sone/fcp/UnlockSoneCommandTest.java +++ b/src/test/java/net/pterodactylus/sone/fcp/UnlockSoneCommandTest.java @@ -17,10 +17,10 @@ package net.pterodactylus.sone.fcp; +import static com.google.common.base.Optional.of; +import static net.pterodactylus.sone.Verifiers.verifyAnswer; import static org.hamcrest.CoreMatchers.is; -import static org.hamcrest.CoreMatchers.notNullValue; import static org.hamcrest.MatcherAssert.assertThat; -import static org.mockito.Matchers.anyBoolean; import static org.mockito.Matchers.eq; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; @@ -47,18 +47,17 @@ public class UnlockSoneCommandTest { public void testUnlockingALocalSone() throws FcpException { Sone localSone = mock(Sone.class); when(localSone.getId()).thenReturn("LocalSone"); + when(localSone.isLocal()).thenReturn(true); Core core = mock(Core.class); - when(core.getSone(eq("LocalSone"), anyBoolean())).thenReturn(localSone); - when(core.getLocalSone(eq("LocalSone"), anyBoolean())).thenReturn(localSone); + when(core.getSone(eq("LocalSone"))).thenReturn(of(localSone)); + when(core.getLocalSone(eq("LocalSone"))).thenReturn(of(localSone)); SimpleFieldSet fields = new SimpleFieldSetBuilder().put("Sone", "LocalSone").get(); UnlockSoneCommand unlockSoneCommand = new UnlockSoneCommand(core); Response response = unlockSoneCommand.execute(fields, null, null); verify(core).unlockSone(eq(localSone)); - assertThat(response, notNullValue()); - assertThat(response.getReplyParameters(), notNullValue()); - assertThat(response.getReplyParameters().get("Message"), is("SoneUnlocked")); + verifyAnswer(response, "SoneUnlocked"); assertThat(response.getReplyParameters().get("Sone"), is("LocalSone")); } @@ -66,7 +65,7 @@ public class UnlockSoneCommandTest { public void testUnlockingARemoteSone() throws FcpException { Sone removeSone = mock(Sone.class); Core core = mock(Core.class); - when(core.getSone(eq("RemoteSone"), anyBoolean())).thenReturn(removeSone); + when(core.getSone(eq("RemoteSone"))).thenReturn(of(removeSone)); SimpleFieldSet fields = new SimpleFieldSetBuilder().put("Sone", "RemoteSone").get(); UnlockSoneCommand unlockSoneCommand = new UnlockSoneCommand(core);