INT-4206: Upgrade to Mockito 2.5
JIRA: https://jira.spring.io/browse/INT-4206 * Fix unnecessary dependency resolution in BOM module * Fix `MessagingMethodInvokerHelper` to handle `$MockitoMock$` generated classed which isn't CGLib `Proxies` any more * Provide fixes for test classes according upgrade to Mockito `2.5` * Fix Ceckstyle do not allow static imports for deprecated Mockito classes
This commit is contained in:
committed by
Gary Russell
parent
e04a8d9948
commit
54654546b9
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
* Copyright 2002-2017 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.
|
||||
@@ -17,10 +17,10 @@
|
||||
package org.springframework.integration.ws;
|
||||
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.mockito.Matchers.anyLong;
|
||||
import static org.mockito.Matchers.argThat;
|
||||
import static org.mockito.Matchers.eq;
|
||||
import static org.mockito.Matchers.isA;
|
||||
import static org.mockito.ArgumentMatchers.anyLong;
|
||||
import static org.mockito.ArgumentMatchers.argThat;
|
||||
import static org.mockito.ArgumentMatchers.eq;
|
||||
import static org.mockito.ArgumentMatchers.isA;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.verify;
|
||||
import static org.mockito.Mockito.when;
|
||||
@@ -39,7 +39,8 @@ import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.mockito.Mock;
|
||||
import org.mockito.runners.MockitoJUnitRunner;
|
||||
import org.mockito.internal.hamcrest.HamcrestArgumentMatcher;
|
||||
import org.mockito.junit.MockitoJUnitRunner;
|
||||
import org.mockito.stubbing.Answer;
|
||||
|
||||
import org.springframework.beans.factory.BeanFactory;
|
||||
@@ -114,7 +115,7 @@ public class SimpleWebServiceInboundGatewayTests {
|
||||
|
||||
|
||||
private Message<?> messageWithPayload(final Object payload) {
|
||||
return argThat(new BaseMatcher<Message<?>>() {
|
||||
return argThat(new HamcrestArgumentMatcher<>(new BaseMatcher<Message<?>>() {
|
||||
|
||||
@Override
|
||||
public boolean matches(Object candidate) {
|
||||
@@ -126,7 +127,7 @@ public class SimpleWebServiceInboundGatewayTests {
|
||||
description.appendText("A message with payload: " + payload);
|
||||
}
|
||||
|
||||
});
|
||||
}));
|
||||
}
|
||||
|
||||
private Answer<Boolean> withReplyTo(final MessageChannel replyChannel) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 the original author or authors.
|
||||
* Copyright 2016-2017 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.
|
||||
@@ -21,8 +21,8 @@ import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertThat;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.mockito.Matchers.any;
|
||||
import static org.mockito.Matchers.eq;
|
||||
import static org.mockito.ArgumentMatchers.any;
|
||||
import static org.mockito.ArgumentMatchers.eq;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.verify;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
* Copyright 2002-2017 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.
|
||||
@@ -114,9 +114,9 @@ public class UriVariableTests {
|
||||
public void testHttpUriVariables() {
|
||||
WebServiceTemplate webServiceTemplate = TestUtils.getPropertyValue(this.httpOutboundGateway, "webServiceTemplate", WebServiceTemplate.class);
|
||||
webServiceTemplate = Mockito.spy(webServiceTemplate);
|
||||
final AtomicReference<String> uri = new AtomicReference<String>();
|
||||
final AtomicReference<String> uri = new AtomicReference<>();
|
||||
doAnswer(invocation -> {
|
||||
uri.set(invocation.getArgumentAt(0, String.class));
|
||||
uri.set(invocation.getArgument(0));
|
||||
throw new WebServiceIOException("intentional");
|
||||
}).when(webServiceTemplate)
|
||||
.sendAndReceive(Mockito.anyString(),
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
* Copyright 2002-2017 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.
|
||||
@@ -20,16 +20,16 @@ import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertNull;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.mockito.Matchers.any;
|
||||
import static org.mockito.Matchers.anyString;
|
||||
import static org.mockito.Matchers.eq;
|
||||
import static org.mockito.ArgumentMatchers.any;
|
||||
import static org.mockito.ArgumentMatchers.anyString;
|
||||
import static org.mockito.ArgumentMatchers.eq;
|
||||
import static org.mockito.Mockito.doReturn;
|
||||
import static org.mockito.Mockito.spy;
|
||||
import static org.mockito.Mockito.verify;
|
||||
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
import org.mockito.Matchers;
|
||||
import org.mockito.ArgumentMatchers;
|
||||
|
||||
import org.springframework.beans.DirectFieldAccessor;
|
||||
import org.springframework.beans.factory.parsing.BeanDefinitionParsingException;
|
||||
@@ -445,7 +445,7 @@ public class WebServiceOutboundGatewayParserTests {
|
||||
|
||||
doReturn(null).when(webServiceTemplate).sendAndReceive(anyString(),
|
||||
any(WebServiceMessageCallback.class),
|
||||
Matchers.<WebServiceMessageExtractor<Object>>any());
|
||||
ArgumentMatchers.<WebServiceMessageExtractor<Object>>any());
|
||||
|
||||
new DirectFieldAccessor(handler).setPropertyValue("webServiceTemplate", webServiceTemplate);
|
||||
|
||||
@@ -453,7 +453,7 @@ public class WebServiceOutboundGatewayParserTests {
|
||||
|
||||
verify(webServiceTemplate).sendAndReceive(eq("jms:wsQueue"),
|
||||
any(WebServiceMessageCallback.class),
|
||||
Matchers.<WebServiceMessageExtractor<Object>>any());
|
||||
ArgumentMatchers.<WebServiceMessageExtractor<Object>>any());
|
||||
context.close();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user