import static org.mockito.Matchers.eq;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
import static org.mockito.Matchers.eq;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
public void testUnlockingALocalSone() throws FcpException {
Sone localSone = mock(Sone.class);
when(localSone.getId()).thenReturn("LocalSone");
public void testUnlockingALocalSone() throws FcpException {
Sone localSone = mock(Sone.class);
when(localSone.getId()).thenReturn("LocalSone");
- 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));
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");
public void testUnlockingARemoteSone() throws FcpException {
Sone removeSone = mock(Sone.class);
Core core = mock(Core.class);
public void testUnlockingARemoteSone() throws FcpException {
Sone removeSone = mock(Sone.class);
Core core = mock(Core.class);
SimpleFieldSet fields = new SimpleFieldSetBuilder().put("Sone", "RemoteSone").get();
UnlockSoneCommand unlockSoneCommand = new UnlockSoneCommand(core);
SimpleFieldSet fields = new SimpleFieldSetBuilder().put("Sone", "RemoteSone").get();
UnlockSoneCommand unlockSoneCommand = new UnlockSoneCommand(core);