Fix Mockito deprecations

See gh-18689
pull/18702/head
dreis2211 5 years ago committed by Stephane Nicoll
parent 511a2a073f
commit 8ecdf919f8

@ -38,7 +38,7 @@ import static org.mockito.BDDMockito.given;
import static org.mockito.Mockito.inOrder; import static org.mockito.Mockito.inOrder;
import static org.mockito.Mockito.mock; import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify; import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.verifyZeroInteractions; import static org.mockito.Mockito.verifyNoInteractions;
/** /**
* Tests for {@link MeterRegistryConfigurer}. * Tests for {@link MeterRegistryConfigurer}.
@ -128,7 +128,7 @@ class MeterRegistryConfigurerTests {
MeterRegistryConfigurer configurer = new MeterRegistryConfigurer(createObjectProvider(this.customizers), MeterRegistryConfigurer configurer = new MeterRegistryConfigurer(createObjectProvider(this.customizers),
createObjectProvider(this.filters), createObjectProvider(this.binders), false, true); createObjectProvider(this.filters), createObjectProvider(this.binders), false, true);
configurer.configure(this.mockRegistry); configurer.configure(this.mockRegistry);
verifyZeroInteractions(this.mockBinder); verifyNoInteractions(this.mockBinder);
} }
@Test @Test

@ -35,7 +35,7 @@ import static org.mockito.ArgumentMatchers.anyString;
import static org.mockito.BDDMockito.given; import static org.mockito.BDDMockito.given;
import static org.mockito.Mockito.mock; import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify; import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.verifyZeroInteractions; import static org.mockito.Mockito.verifyNoInteractions;
/** /**
* Tests for {@link HealthWebEndpointResponseMapper}. * Tests for {@link HealthWebEndpointResponseMapper}.
@ -56,8 +56,8 @@ class HealthWebEndpointResponseMapperTests {
SecurityContext securityContext = mock(SecurityContext.class); SecurityContext securityContext = mock(SecurityContext.class);
WebEndpointResponse<Health> response = mapper.mapDetails(supplier, securityContext); WebEndpointResponse<Health> response = mapper.mapDetails(supplier, securityContext);
assertThat(response.getStatus()).isEqualTo(HttpStatus.NOT_FOUND.value()); assertThat(response.getStatus()).isEqualTo(HttpStatus.NOT_FOUND.value());
verifyZeroInteractions(supplier); verifyNoInteractions(supplier);
verifyZeroInteractions(securityContext); verifyNoInteractions(securityContext);
} }
@Test @Test
@ -68,7 +68,7 @@ class HealthWebEndpointResponseMapperTests {
WebEndpointResponse<Health> response = mapper.mapDetails(supplier, securityContext); WebEndpointResponse<Health> response = mapper.mapDetails(supplier, securityContext);
assertThat(response.getStatus()).isEqualTo(HttpStatus.NOT_FOUND.value()); assertThat(response.getStatus()).isEqualTo(HttpStatus.NOT_FOUND.value());
assertThat(response.getBody()).isNull(); assertThat(response.getBody()).isNull();
verifyZeroInteractions(supplier); verifyNoInteractions(supplier);
verify(securityContext).isUserInRole("ACTUATOR"); verify(securityContext).isUserInRole("ACTUATOR");
} }
@ -94,7 +94,7 @@ class HealthWebEndpointResponseMapperTests {
assertThat(response.getStatus()).isEqualTo(HttpStatus.NOT_FOUND.value()); assertThat(response.getStatus()).isEqualTo(HttpStatus.NOT_FOUND.value());
assertThat(response.getBody()).isNull(); assertThat(response.getBody()).isNull();
verify(supplier).get(); verify(supplier).get();
verifyZeroInteractions(securityContext); verifyNoInteractions(securityContext);
} }
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")

@ -45,7 +45,7 @@ import org.springframework.test.web.reactive.server.WebTestClient;
import static org.mockito.BDDMockito.given; import static org.mockito.BDDMockito.given;
import static org.mockito.Mockito.mock; import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify; import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.verifyZeroInteractions; import static org.mockito.Mockito.verifyNoInteractions;
/** /**
* Integration tests for {@link LoggersEndpoint} when exposed via Jersey, Spring MVC, and * Integration tests for {@link LoggersEndpoint} when exposed via Jersey, Spring MVC, and
@ -165,7 +165,7 @@ class LoggersEndpointWebIntegrationTests {
this.client.post().uri("/actuator/loggers/ROOT").contentType(MediaType.APPLICATION_JSON) this.client.post().uri("/actuator/loggers/ROOT").contentType(MediaType.APPLICATION_JSON)
.bodyValue(Collections.singletonMap("configuredLevel", "other")).exchange().expectStatus() .bodyValue(Collections.singletonMap("configuredLevel", "other")).exchange().expectStatus()
.isBadRequest(); .isBadRequest();
verifyZeroInteractions(this.loggingSystem); verifyNoInteractions(this.loggingSystem);
} }
@WebEndpointTest @WebEndpointTest

@ -44,7 +44,7 @@ import static org.mockito.BDDMockito.willThrow;
import static org.mockito.Mockito.mock; import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.never; import static org.mockito.Mockito.never;
import static org.mockito.Mockito.verify; import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.verifyZeroInteractions; import static org.mockito.Mockito.verifyNoInteractions;
/** /**
* Tests for {@link PrometheusPushGatewayManager}. * Tests for {@link PrometheusPushGatewayManager}.
@ -162,7 +162,7 @@ class PrometheusPushGatewayManagerTests {
this.scheduler, this.pushRate, "job", this.groupingKey, ShutdownOperation.NONE); this.scheduler, this.pushRate, "job", this.groupingKey, ShutdownOperation.NONE);
manager.shutdown(); manager.shutdown();
verify(this.future).cancel(false); verify(this.future).cancel(false);
verifyZeroInteractions(this.pushGateway); verifyNoInteractions(this.pushGateway);
} }
@Test @Test

@ -40,7 +40,7 @@ import org.springframework.core.type.classreading.SimpleMetadataReaderFactory;
import org.springframework.util.ClassUtils; import org.springframework.util.ClassUtils;
import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.Mockito.verifyZeroInteractions; import static org.mockito.Mockito.verifyNoInteractions;
/** /**
* Tests for {@link ImportAutoConfigurationImportSelector}. * Tests for {@link ImportAutoConfigurationImportSelector}.
@ -83,7 +83,7 @@ class ImportAutoConfigurationImportSelectorTests {
void propertyExclusionsAreNotApplied() throws Exception { void propertyExclusionsAreNotApplied() throws Exception {
AnnotationMetadata annotationMetadata = getAnnotationMetadata(ImportFreeMarker.class); AnnotationMetadata annotationMetadata = getAnnotationMetadata(ImportFreeMarker.class);
this.importSelector.selectImports(annotationMetadata); this.importSelector.selectImports(annotationMetadata);
verifyZeroInteractions(this.environment); verifyNoInteractions(this.environment);
} }
@Test @Test

@ -67,7 +67,7 @@ import org.springframework.util.Assert;
import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.Mockito.mock; import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verifyZeroInteractions; import static org.mockito.Mockito.verifyNoInteractions;
/** /**
* Tests for {@link QuartzAutoConfiguration}. * Tests for {@link QuartzAutoConfiguration}.
@ -157,7 +157,7 @@ class QuartzAutoConfigurationTests {
Scheduler scheduler = context.getBean(Scheduler.class); Scheduler scheduler = context.getBean(Scheduler.class);
assertThat(scheduler.getMetaData().getThreadPoolSize()).isEqualTo(50); assertThat(scheduler.getMetaData().getThreadPoolSize()).isEqualTo(50);
Executor executor = context.getBean(Executor.class); Executor executor = context.getBean(Executor.class);
verifyZeroInteractions(executor); verifyNoInteractions(executor);
}); });
} }

@ -42,7 +42,7 @@ import static org.mockito.ArgumentMatchers.any;
import static org.mockito.BDDMockito.willReturn; import static org.mockito.BDDMockito.willReturn;
import static org.mockito.Mockito.mock; import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify; import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.verifyZeroInteractions; import static org.mockito.Mockito.verifyNoInteractions;
/** /**
* Tests for {@link DispatcherFilter}. * Tests for {@link DispatcherFilter}.
@ -82,7 +82,7 @@ class DispatcherFilterTests {
ServletRequest request = mock(ServletRequest.class); ServletRequest request = mock(ServletRequest.class);
ServletResponse response = mock(ServletResponse.class); ServletResponse response = mock(ServletResponse.class);
this.filter.doFilter(request, response, this.chain); this.filter.doFilter(request, response, this.chain);
verifyZeroInteractions(this.dispatcher); verifyNoInteractions(this.dispatcher);
verify(this.chain).doFilter(request, response); verify(this.chain).doFilter(request, response);
} }
@ -100,7 +100,7 @@ class DispatcherFilterTests {
HttpServletResponse response = new MockHttpServletResponse(); HttpServletResponse response = new MockHttpServletResponse();
willReturn(true).given(this.dispatcher).handle(any(ServerHttpRequest.class), any(ServerHttpResponse.class)); willReturn(true).given(this.dispatcher).handle(any(ServerHttpRequest.class), any(ServerHttpResponse.class));
this.filter.doFilter(request, response, this.chain); this.filter.doFilter(request, response, this.chain);
verifyZeroInteractions(this.chain); verifyNoInteractions(this.chain);
verify(this.dispatcher).handle(this.serverRequestCaptor.capture(), this.serverResponseCaptor.capture()); verify(this.dispatcher).handle(this.serverRequestCaptor.capture(), this.serverResponseCaptor.capture());
ServerHttpRequest dispatcherRequest = this.serverRequestCaptor.getValue(); ServerHttpRequest dispatcherRequest = this.serverRequestCaptor.getValue();
ServletServerHttpRequest actualRequest = (ServletServerHttpRequest) dispatcherRequest; ServletServerHttpRequest actualRequest = (ServletServerHttpRequest) dispatcherRequest;

@ -41,7 +41,7 @@ import static org.mockito.BDDMockito.given;
import static org.mockito.Mockito.inOrder; import static org.mockito.Mockito.inOrder;
import static org.mockito.Mockito.mock; import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify; import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.verifyZeroInteractions; import static org.mockito.Mockito.verifyNoInteractions;
import static org.mockito.Mockito.withSettings; import static org.mockito.Mockito.withSettings;
/** /**
@ -91,7 +91,7 @@ class DispatcherTests {
given(mapper.getHandler(any(ServerHttpRequest.class))).willReturn(handler); given(mapper.getHandler(any(ServerHttpRequest.class))).willReturn(handler);
Dispatcher dispatcher = new Dispatcher(this.accessManager, Collections.singleton(mapper)); Dispatcher dispatcher = new Dispatcher(this.accessManager, Collections.singleton(mapper));
dispatcher.handle(this.serverRequest, this.serverResponse); dispatcher.handle(this.serverRequest, this.serverResponse);
verifyZeroInteractions(handler); verifyNoInteractions(handler);
assertThat(this.response.getStatus()).isEqualTo(403); assertThat(this.response.getStatus()).isEqualTo(403);
} }

@ -47,7 +47,7 @@ import static org.assertj.core.api.Assertions.assertThatIllegalStateException;
import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.any;
import static org.mockito.BDDMockito.given; import static org.mockito.BDDMockito.given;
import static org.mockito.Mockito.mock; import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verifyZeroInteractions; import static org.mockito.Mockito.verifyNoInteractions;
/** /**
* Tests for {@link Restarter}. * Tests for {@link Restarter}.
@ -136,7 +136,7 @@ class RestarterTests {
ObjectFactory objectFactory = mock(ObjectFactory.class); ObjectFactory objectFactory = mock(ObjectFactory.class);
Object attribute = Restarter.getInstance().getOrAddAttribute("x", objectFactory); Object attribute = Restarter.getInstance().getOrAddAttribute("x", objectFactory);
assertThat(attribute).isEqualTo("abc"); assertThat(attribute).isEqualTo("abc");
verifyZeroInteractions(objectFactory); verifyNoInteractions(objectFactory);
} }
@Test @Test

@ -38,7 +38,7 @@ import org.springframework.mock.web.MockHttpServletResponse;
import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException; import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException;
import static org.mockito.Mockito.verify; import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.verifyZeroInteractions; import static org.mockito.Mockito.verifyNoInteractions;
/** /**
* Tests for {@link HttpRestartServer}. * Tests for {@link HttpRestartServer}.
@ -92,7 +92,7 @@ class HttpRestartServerTests {
MockHttpServletRequest request = new MockHttpServletRequest(); MockHttpServletRequest request = new MockHttpServletRequest();
MockHttpServletResponse response = new MockHttpServletResponse(); MockHttpServletResponse response = new MockHttpServletResponse();
this.server.handle(new ServletServerHttpRequest(request), new ServletServerHttpResponse(response)); this.server.handle(new ServletServerHttpRequest(request), new ServletServerHttpResponse(response));
verifyZeroInteractions(this.delegate); verifyNoInteractions(this.delegate);
assertThat(response.getStatus()).isEqualTo(500); assertThat(response.getStatus()).isEqualTo(500);
} }
@ -103,7 +103,7 @@ class HttpRestartServerTests {
MockHttpServletResponse response = new MockHttpServletResponse(); MockHttpServletResponse response = new MockHttpServletResponse();
request.setContent(new byte[] { 0, 0, 0 }); request.setContent(new byte[] { 0, 0, 0 });
this.server.handle(new ServletServerHttpRequest(request), new ServletServerHttpResponse(response)); this.server.handle(new ServletServerHttpRequest(request), new ServletServerHttpResponse(response));
verifyZeroInteractions(this.delegate); verifyNoInteractions(this.delegate);
assertThat(response.getStatus()).isEqualTo(500); assertThat(response.getStatus()).isEqualTo(500);
} }

@ -33,7 +33,7 @@ import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatExceptionOfType; import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
import static org.mockito.BDDMockito.given; import static org.mockito.BDDMockito.given;
import static org.mockito.Mockito.mock; import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verifyZeroInteractions; import static org.mockito.Mockito.verifyNoInteractions;
/** /**
* Tests for {@link PropertyMappingContextCustomizerFactory}. * Tests for {@link PropertyMappingContextCustomizerFactory}.
@ -53,7 +53,7 @@ class PropertyMappingContextCustomizerFactoryTests {
given(context.getEnvironment()).willReturn(environment); given(context.getEnvironment()).willReturn(environment);
given(context.getBeanFactory()).willReturn(beanFactory); given(context.getBeanFactory()).willReturn(beanFactory);
customizer.customizeContext(context, null); customizer.customizeContext(context, null);
verifyZeroInteractions(environment); verifyNoInteractions(environment);
} }
@Test @Test

@ -23,7 +23,7 @@ import org.junit.jupiter.api.Test;
import static org.mockito.Mockito.mock; import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify; import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.verifyZeroInteractions; import static org.mockito.Mockito.verifyNoInteractions;
/** /**
* Tests for {@link SpringBootExceptionHandler}. * Tests for {@link SpringBootExceptionHandler}.
@ -43,7 +43,7 @@ class SpringBootExceptionHandlerTests {
Exception ex = new Exception(); Exception ex = new Exception();
this.handler.registerLoggedException(ex); this.handler.registerLoggedException(ex);
this.handler.uncaughtException(thread, ex); this.handler.uncaughtException(thread, ex);
verifyZeroInteractions(this.parent); verifyNoInteractions(this.parent);
} }
@Test @Test

@ -33,7 +33,7 @@ import static org.assertj.core.api.Assertions.assertThatIOException;
import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException; import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException;
import static org.mockito.BDDMockito.given; import static org.mockito.BDDMockito.given;
import static org.mockito.Mockito.verify; import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.verifyZeroInteractions; import static org.mockito.Mockito.verifyNoInteractions;
/** /**
* Tests for {@link BindResult}. * Tests for {@link BindResult}.
@ -100,7 +100,7 @@ class BindResultTests {
void ifBoundWhenHasNoValueShouldNotCallConsumer() { void ifBoundWhenHasNoValueShouldNotCallConsumer() {
BindResult<String> result = BindResult.of(null); BindResult<String> result = BindResult.of(null);
result.ifBound(this.consumer); result.ifBound(this.consumer);
verifyZeroInteractions(this.consumer); verifyNoInteractions(this.consumer);
} }
@Test @Test
@ -121,7 +121,7 @@ class BindResultTests {
void mapWhenHasNoValueShouldNotCallMapper() { void mapWhenHasNoValueShouldNotCallMapper() {
BindResult<String> result = BindResult.of(null); BindResult<String> result = BindResult.of(null);
result.map(this.mapper); result.map(this.mapper);
verifyZeroInteractions(this.mapper); verifyNoInteractions(this.mapper);
} }
@Test @Test
@ -140,7 +140,7 @@ class BindResultTests {
void orElseGetWhenHasValueShouldReturnValue() { void orElseGetWhenHasValueShouldReturnValue() {
BindResult<String> result = BindResult.of("foo"); BindResult<String> result = BindResult.of("foo");
assertThat(result.orElseGet(this.supplier)).isEqualTo("foo"); assertThat(result.orElseGet(this.supplier)).isEqualTo("foo");
verifyZeroInteractions(this.supplier); verifyNoInteractions(this.supplier);
} }
@Test @Test

@ -26,8 +26,8 @@ import org.springframework.test.util.ReflectionTestUtils;
import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.Mockito.mock; import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify; import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.verifyNoInteractions;
import static org.mockito.Mockito.verifyNoMoreInteractions; import static org.mockito.Mockito.verifyNoMoreInteractions;
import static org.mockito.Mockito.verifyZeroInteractions;
/** /**
* Tests for {@link DeferredLog}. * Tests for {@link DeferredLog}.
@ -168,7 +168,7 @@ class DeferredLogTests {
verify(this.log).info("1", null); verify(this.log).info("1", null);
verify(this.log).fatal("2", null); verify(this.log).fatal("2", null);
verifyNoMoreInteractions(this.log); verifyNoMoreInteractions(this.log);
verifyZeroInteractions(log2); verifyNoInteractions(log2);
} }
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")

@ -31,7 +31,7 @@ import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException
import static org.mockito.Mockito.mock; import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.spy; import static org.mockito.Mockito.spy;
import static org.mockito.Mockito.verify; import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.verifyZeroInteractions; import static org.mockito.Mockito.verifyNoInteractions;
/** /**
* Tests for {@link TaskExecutorBuilder}. * Tests for {@link TaskExecutorBuilder}.
@ -125,7 +125,7 @@ class TaskExecutorBuilderTests {
TaskExecutorCustomizer customizer2 = mock(TaskExecutorCustomizer.class); TaskExecutorCustomizer customizer2 = mock(TaskExecutorCustomizer.class);
ThreadPoolTaskExecutor executor = this.builder.customizers(customizer1) ThreadPoolTaskExecutor executor = this.builder.customizers(customizer1)
.customizers(Collections.singleton(customizer2)).build(); .customizers(Collections.singleton(customizer2)).build();
verifyZeroInteractions(customizer1); verifyNoInteractions(customizer1);
verify(customizer2).customize(executor); verify(customizer2).customize(executor);
} }

@ -29,7 +29,7 @@ import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException
import static org.mockito.Mockito.mock; import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.spy; import static org.mockito.Mockito.spy;
import static org.mockito.Mockito.verify; import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.verifyZeroInteractions; import static org.mockito.Mockito.verifyNoInteractions;
/** /**
* Tests for {@link TaskSchedulerBuilder}. * Tests for {@link TaskSchedulerBuilder}.
@ -101,7 +101,7 @@ class TaskSchedulerBuilderTests {
TaskSchedulerCustomizer customizer2 = mock(TaskSchedulerCustomizer.class); TaskSchedulerCustomizer customizer2 = mock(TaskSchedulerCustomizer.class);
ThreadPoolTaskScheduler scheduler = this.builder.customizers(customizer1) ThreadPoolTaskScheduler scheduler = this.builder.customizers(customizer1)
.customizers(Collections.singleton(customizer2)).build(); .customizers(Collections.singleton(customizer2)).build();
verifyZeroInteractions(customizer1); verifyNoInteractions(customizer1);
verify(customizer2).customize(scheduler); verify(customizer2).customize(scheduler);
} }

@ -35,7 +35,7 @@ import static org.mockito.ArgumentMatchers.contains;
import static org.mockito.BDDMockito.given; import static org.mockito.BDDMockito.given;
import static org.mockito.Mockito.mock; import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify; import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.verifyZeroInteractions; import static org.mockito.Mockito.verifyNoInteractions;
/** /**
* Tests for {@link LambdaSafe}. * Tests for {@link LambdaSafe}.
@ -88,7 +88,7 @@ class LambdaSafeTests {
GenericCallback<?> callbackInstance = mock(StringBuilderCallback.class); GenericCallback<?> callbackInstance = mock(StringBuilderCallback.class);
String argument = "foo"; String argument = "foo";
LambdaSafe.callback(GenericCallback.class, callbackInstance, argument).invoke((c) -> c.handle(argument)); LambdaSafe.callback(GenericCallback.class, callbackInstance, argument).invoke((c) -> c.handle(argument));
verifyZeroInteractions(callbackInstance); verifyNoInteractions(callbackInstance);
} }
@Test @Test
@ -164,7 +164,7 @@ class LambdaSafeTests {
InvocationResult<Integer> result = LambdaSafe.callback(GenericFactory.class, callbackInstance, argument) InvocationResult<Integer> result = LambdaSafe.callback(GenericFactory.class, callbackInstance, argument)
.invokeAnd((c) -> c.handle(argument)); .invokeAnd((c) -> c.handle(argument));
assertThat(result.hasResult()).isFalse(); assertThat(result.hasResult()).isFalse();
verifyZeroInteractions(callbackInstance); verifyNoInteractions(callbackInstance);
} }
@Test @Test
@ -229,7 +229,7 @@ class LambdaSafeTests {
String argument = "foo"; String argument = "foo";
LambdaSafe.callbacks(GenericCallback.class, Collections.singleton(callbackInstance), argument) LambdaSafe.callbacks(GenericCallback.class, Collections.singleton(callbackInstance), argument)
.invoke((c) -> c.handle(null)); .invoke((c) -> c.handle(null));
verifyZeroInteractions(callbackInstance); verifyNoInteractions(callbackInstance);
} }
@Test @Test

@ -62,7 +62,7 @@ import static org.mockito.Mockito.inOrder;
import static org.mockito.Mockito.mock; import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.spy; import static org.mockito.Mockito.spy;
import static org.mockito.Mockito.verify; import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.verifyZeroInteractions; import static org.mockito.Mockito.verifyNoInteractions;
import static org.springframework.test.web.client.match.MockRestRequestMatchers.requestTo; import static org.springframework.test.web.client.match.MockRestRequestMatchers.requestTo;
import static org.springframework.test.web.client.response.MockRestResponseCreators.withSuccess; import static org.springframework.test.web.client.response.MockRestResponseCreators.withSuccess;
@ -391,7 +391,7 @@ class RestTemplateBuilderTests {
RestTemplateCustomizer customizer2 = mock(RestTemplateCustomizer.class); RestTemplateCustomizer customizer2 = mock(RestTemplateCustomizer.class);
RestTemplate template = this.builder.customizers(customizer1).customizers(Collections.singleton(customizer2)) RestTemplate template = this.builder.customizers(customizer1).customizers(Collections.singleton(customizer2))
.build(); .build();
verifyZeroInteractions(customizer1); verifyNoInteractions(customizer1);
verify(customizer2).customize(template); verify(customizer2).customize(template);
} }

@ -47,7 +47,7 @@ import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.mock; import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.spy; import static org.mockito.Mockito.spy;
import static org.mockito.Mockito.verify; import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.verifyZeroInteractions; import static org.mockito.Mockito.verifyNoInteractions;
/** /**
* Tests for {@link WebServiceTemplateBuilder}. * Tests for {@link WebServiceTemplateBuilder}.
@ -241,7 +241,7 @@ class WebServiceTemplateBuilderTests {
WebServiceTemplateCustomizer customizer2 = mock(WebServiceTemplateCustomizer.class); WebServiceTemplateCustomizer customizer2 = mock(WebServiceTemplateCustomizer.class);
WebServiceTemplate template = this.builder.customizers(customizer1) WebServiceTemplate template = this.builder.customizers(customizer1)
.customizers(Collections.singleton(customizer2)).build(); .customizers(Collections.singleton(customizer2)).build();
verifyZeroInteractions(customizer1); verifyNoInteractions(customizer1);
verify(customizer2).customize(template); verify(customizer2).customize(template);
} }

Loading…
Cancel
Save