Mockito Polishing

`$ find spring-integration-* | grep '\.java$' | xargs sed -E -i '' -e 's/(\(?)\(([^<()]*)\) *invocation.getArguments\(\)\[([0-9]*)\]/\1invocation.getArgumentAt(\3, \2.class)/'`
This commit is contained in:
Gary Russell
2016-10-28 08:16:56 -04:00
committed by Artem Bilan
parent 9225c514fe
commit c5fbd93787
27 changed files with 58 additions and 58 deletions

View File

@@ -61,7 +61,7 @@ public class XmppHeaderEnricherParserTests {
MessageHandler handler = mock(MessageHandler.class);
doAnswer(new Answer() {
public Object answer(InvocationOnMock invocation) throws Throwable {
Message message = (Message) invocation.getArguments()[0];
Message message = invocation.getArgumentAt(0, Message.class);
String chatToUser = (String) message.getHeaders().get(XmppHeaders.TO);
assertNotNull(chatToUser);
assertEquals("test1@example.org", chatToUser);

View File

@@ -85,7 +85,7 @@ public class ChatMessageListeningEndpointTests {
@Override
public Object answer(InvocationOnMock invocation) throws Throwable {
packetListSet.add((StanzaListener) invocation.getArguments()[0]);
packetListSet.add(invocation.getArgumentAt(0, StanzaListener.class));
return null;
}

View File

@@ -70,7 +70,7 @@ public class PresenceListeningEndpointTests {
@Override
public Object answer(InvocationOnMock invocation) throws Throwable {
rosterSet.add((RosterListener) invocation.getArguments()[0]);
rosterSet.add(invocation.getArgumentAt(0, RosterListener.class));
return null;
}
@@ -80,7 +80,7 @@ public class PresenceListeningEndpointTests {
@Override
public Object answer(InvocationOnMock invocation) throws Throwable {
rosterSet.remove((RosterListener) invocation.getArguments()[0]);
rosterSet.remove(invocation.getArgumentAt(0, RosterListener.class));
return null;
}