FilterAction mock = mock(FilterAction.class);
when(mock.filter(any(MethodCallMessage.class), any(Map.class))).thenReturn(RESULT_MESSAGE);
when(mock.getSupportedInputType()).thenAnswer(new Returns(String.class));
when(mock.getSupportedOutputType()).thenAnswer(new Returns(String.class));
jsonOutgoingMethodCallMarshalFilter.setNext(mock);
MethodResultMessage result =
(MethodResultMessage) jsonOutgoingMethodCallMarshalFilter.filter(new MethodCallMessage(),
new HashMap<String, Object>());
Object arg = result.getResult().getArg();
assertThat(arg, is(TestModel.class));
TestModel resultModel = (TestModel) arg;
assertThat(resultModel.getId(), is(42));
assertThat(resultModel.getName(), is("foo"));
}