StopCommand extends Stop implements UpnpSetCommand { @Override public final void failure(ActionInvocation invocation, UpnpResponse response, String defaultMsg) { failureHandler.handle(defaultMsg); } StopCommand(UpnpDevice device, CommandFailureHandler failureHandler); @Override final void failure(ActionInvocation invocation, UpnpResponse response, String defaultMsg); @Override final void success(ActionInvocation invocation);  }
@Test public void testStopCommandFailure() { UpnpDevice device = createMock(UpnpDevice.class); CommandFailureHandler failureHandler = createMock(CommandFailureHandler.class); ActionInvocation invocation = createMock(ActionInvocation.class); RemoteService avTransportService = createMock(RemoteService.class); Action<RemoteService> stopAction = createMock(Action.class); ActionArgument<RemoteService> actionArgument = createMock(ActionArgument.class); Datatype dataType = createMock(Datatype.class); UpnpResponse response = createMock(UpnpResponse.class); expect(device.getAvTransportService()).andReturn(avTransportService); expect(avTransportService.getAction("Stop")).andReturn(stopAction); expect(stopAction.getInputArgument("InstanceID")).andReturn(actionArgument); expect(actionArgument.getDatatype()).andReturn(dataType); expect(actionArgument.getName()).andReturn("name"); expect(dataType.isValid(anyObject())).andReturn(TRUE); expect(dataType.getString(anyObject())).andReturn(""); failureHandler.handle("message"); expectLastCall(); replay(device, failureHandler, invocation, avTransportService, stopAction, actionArgument, dataType, response); StopCommand command = new StopCommand(device, failureHandler) { @Override public void success() { } }; command.failure(invocation, response, "message"); verify(device, failureHandler, invocation, avTransportService, stopAction, actionArgument, dataType, response); }