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

@@ -120,7 +120,7 @@ public class HttpProxyScenarioTests {
final String contentDispositionValue = "attachment; filename=\"test.txt\"";
Mockito.doAnswer(invocation -> {
URI uri = (URI) invocation.getArguments()[0];
URI uri = invocation.getArgumentAt(0, URI.class);
assertEquals(new URI("http://testServer/test?foo=bar&FOO=BAR"), uri);
HttpEntity<?> httpEntity = (HttpEntity<?>) invocation.getArguments()[2];
HttpHeaders httpHeaders = httpEntity.getHeaders();
@@ -173,7 +173,7 @@ public class HttpProxyScenarioTests {
RestTemplate template = Mockito.spy(new RestTemplate());
Mockito.doAnswer(invocation -> {
URI uri = (URI) invocation.getArguments()[0];
URI uri = invocation.getArgumentAt(0, URI.class);
assertEquals(new URI("http://testServer/testmp"), uri);
HttpEntity<?> httpEntity = (HttpEntity<?>) invocation.getArguments()[2];
HttpHeaders httpHeaders = httpEntity.getHeaders();

View File

@@ -73,7 +73,7 @@ public class MultipartAsRawByteArrayTests {
@Override
public Integer answer(InvocationOnMock invocation) throws Throwable {
byte[] buff = (byte[]) invocation.getArguments()[0];
byte[] buff = invocation.getArgumentAt(0, byte[].class);
buff[0] = 'f';
buff[1] = 'o';
buff[2] = 'o';