Replace casted Mockito.any() calls

Closes gh-11817
This commit is contained in:
dreis2211
2018-01-28 17:29:35 +01:00
committed by Stephane Nicoll
parent ab02e48c44
commit a7663c88d3
16 changed files with 41 additions and 41 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2017 the original author or authors.
* Copyright 2012-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -74,7 +74,7 @@ public class MockitoTestExecutionListenerTests {
WithMockBean instance = new WithMockBean();
this.listener.prepareTestInstance(mockTestContext(instance));
verify(this.postProcessor).inject(this.fieldCaptor.capture(), eq(instance),
(MockDefinition) any());
any(MockDefinition.class));
assertThat(this.fieldCaptor.getValue().getName()).isEqualTo("mockBean");
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2017 the original author or authors.
* Copyright 2012-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -118,7 +118,7 @@ public class RootUriRequestExpectationManagerTests {
throws Exception {
ClientHttpRequest request = mock(ClientHttpRequest.class);
given(request.getURI()).willReturn(new URI(this.uri + "/hello"));
given(this.delegate.validateRequest((ClientHttpRequest) any()))
given(this.delegate.validateRequest(any(ClientHttpRequest.class)))
.willThrow(new AssertionError(
"Request URI expected:</hello> was:<http://example.com/bad>"));
this.thrown.expect(AssertionError.class);

View File

@@ -336,7 +336,7 @@ public class TestRestTemplateTests {
request.setResponse(new MockClientHttpResponse(new byte[0], HttpStatus.OK));
URI absoluteUri = URI
.create("http://localhost:8080/a/b/c.txt?param=%7Bsomething%7D");
given(requestFactory.createRequest(eq(absoluteUri), (HttpMethod) any()))
given(requestFactory.createRequest(eq(absoluteUri), any(HttpMethod.class)))
.willReturn(request);
RestTemplate delegate = new RestTemplate();
TestRestTemplate template = new TestRestTemplate(delegate);
@@ -346,7 +346,7 @@ public class TestRestTemplateTests {
template.setUriTemplateHandler(uriTemplateHandler);
callback.doWithTestRestTemplate(template,
URI.create("/a/b/c.txt?param=%7Bsomething%7D"));
verify(requestFactory).createRequest(eq(absoluteUri), (HttpMethod) any());
verify(requestFactory).createRequest(eq(absoluteUri), any(HttpMethod.class));
}
private void assertBasicAuthorizationInterceptorCredentials(