This is an automated email from the ASF dual-hosted git repository. aldettinger pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/master by this push: new f4476bd CAMEL-11869: Upgrade mockito-core to 2.11.0 for camel-couchdb f4476bd is described below commit f4476bd2ef14ce63fa73253bb2e6c95d04fb5eda Author: aldettinger <aldettin...@gmail.com> AuthorDate: Fri Nov 10 19:26:29 2017 +0100 CAMEL-11869: Upgrade mockito-core to 2.11.0 for camel-couchdb --- components/camel-couchdb/pom.xml | 42 +++++++++++----------- .../couchdb/CouchDbChangesetTrackerTest.java | 16 ++++----- .../component/couchdb/CouchDbComponentTest.java | 2 +- .../component/couchdb/CouchDbEndpointTest.java | 1 - .../component/couchdb/CouchDbProducerTest.java | 12 +++---- 5 files changed, 32 insertions(+), 41 deletions(-) diff --git a/components/camel-couchdb/pom.xml b/components/camel-couchdb/pom.xml index 972af04..7545e0c 100644 --- a/components/camel-couchdb/pom.xml +++ b/components/camel-couchdb/pom.xml @@ -17,7 +17,8 @@ limitations under the License. --> -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <modelVersion>4.0.0</modelVersion> <parent> @@ -37,23 +38,21 @@ </properties> <dependencies> - <dependency> <groupId>org.apache.camel</groupId> <artifactId>camel-core</artifactId> </dependency> - <dependency> <groupId>org.lightcouch</groupId> <artifactId>lightcouch</artifactId> <version>${lightcouch-version}</version> </dependency> - <!-- prefer to use the httpclient version used by Camel components to align the version --> + <!-- prefer to use the httpclient version used by Camel components to align + the version --> <dependency> <groupId>org.apache.httpcomponents</groupId> <artifactId>httpclient</artifactId> </dependency> - <dependency> <groupId>org.apache.camel</groupId> <artifactId>camel-test</artifactId> @@ -62,24 +61,23 @@ <dependency> <groupId>org.mockito</groupId> <artifactId>mockito-core</artifactId> + <version>${mockito2-version}</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.apache.logging.log4j</groupId> + <artifactId>log4j-api</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.apache.logging.log4j</groupId> + <artifactId>log4j-core</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.apache.logging.log4j</groupId> + <artifactId>log4j-slf4j-impl</artifactId> <scope>test</scope> </dependency> - - - <dependency> - <groupId>org.apache.logging.log4j</groupId> - <artifactId>log4j-api</artifactId> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.apache.logging.log4j</groupId> - <artifactId>log4j-core</artifactId> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.apache.logging.log4j</groupId> - <artifactId>log4j-slf4j-impl</artifactId> - <scope>test</scope> - </dependency> </dependencies> </project> diff --git a/components/camel-couchdb/src/test/java/org/apache/camel/component/couchdb/CouchDbChangesetTrackerTest.java b/components/camel-couchdb/src/test/java/org/apache/camel/component/couchdb/CouchDbChangesetTrackerTest.java index 00aa4d7..dce75c9 100644 --- a/components/camel-couchdb/src/test/java/org/apache/camel/component/couchdb/CouchDbChangesetTrackerTest.java +++ b/components/camel-couchdb/src/test/java/org/apache/camel/component/couchdb/CouchDbChangesetTrackerTest.java @@ -25,15 +25,14 @@ import org.lightcouch.Changes; import org.lightcouch.ChangesResult.Row; import org.lightcouch.CouchDbContext; import org.lightcouch.CouchDbInfo; +import org.mockito.ArgumentMatchers; import org.mockito.Mock; -import org.mockito.runners.MockitoJUnitRunner; +import org.mockito.junit.MockitoJUnitRunner; -import static org.mockito.Matchers.any; -import static org.mockito.Matchers.anyLong; -import static org.mockito.Matchers.anyString; +import static org.mockito.ArgumentMatchers.anyLong; +import static org.mockito.ArgumentMatchers.anyString; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; -import static org.mockito.MockitoAnnotations.initMocks; @RunWith(MockitoJUnitRunner.class) public class CouchDbChangesetTrackerTest { @@ -69,9 +68,6 @@ public class CouchDbChangesetTrackerTest { @Before public void before() { - initMocks(this); - - when(endpoint.isDeletes()).thenReturn(true); when(endpoint.isUpdates()).thenReturn(true); when(client.context()).thenReturn(context); @@ -83,7 +79,7 @@ public class CouchDbChangesetTrackerTest { when(changes.includeDocs(true)).thenReturn(changes); when(changes.since(anyString())).thenReturn(changes); when(changes.heartBeat(anyLong())).thenReturn(changes); - when(changes.style(anyString())).thenReturn(changes); + when(changes.style(ArgumentMatchers.isNull())).thenReturn(changes); when(row1.getSeq()).thenReturn("seq1"); when(row2.getSeq()).thenReturn("seq2"); @@ -124,6 +120,6 @@ public class CouchDbChangesetTrackerTest { tracker.run(); verify(endpoint).createExchange("seq1", "id1", null, false); - verify(processor).process(any(Exchange.class)); + verify(processor).process(ArgumentMatchers.isNull()); } } diff --git a/components/camel-couchdb/src/test/java/org/apache/camel/component/couchdb/CouchDbComponentTest.java b/components/camel-couchdb/src/test/java/org/apache/camel/component/couchdb/CouchDbComponentTest.java index 2d3641c..887cefc 100644 --- a/components/camel-couchdb/src/test/java/org/apache/camel/component/couchdb/CouchDbComponentTest.java +++ b/components/camel-couchdb/src/test/java/org/apache/camel/component/couchdb/CouchDbComponentTest.java @@ -24,7 +24,7 @@ import org.apache.camel.Endpoint; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Mock; -import org.mockito.runners.MockitoJUnitRunner; +import org.mockito.junit.MockitoJUnitRunner; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; diff --git a/components/camel-couchdb/src/test/java/org/apache/camel/component/couchdb/CouchDbEndpointTest.java b/components/camel-couchdb/src/test/java/org/apache/camel/component/couchdb/CouchDbEndpointTest.java index fc9456c..b12170e 100644 --- a/components/camel-couchdb/src/test/java/org/apache/camel/component/couchdb/CouchDbEndpointTest.java +++ b/components/camel-couchdb/src/test/java/org/apache/camel/component/couchdb/CouchDbEndpointTest.java @@ -19,7 +19,6 @@ package org.apache.camel.component.couchdb; import java.util.UUID; import com.google.gson.JsonObject; -import org.apache.camel.CamelContext; import org.apache.camel.Exchange; import org.apache.camel.impl.DefaultCamelContext; import org.junit.Test; diff --git a/components/camel-couchdb/src/test/java/org/apache/camel/component/couchdb/CouchDbProducerTest.java b/components/camel-couchdb/src/test/java/org/apache/camel/component/couchdb/CouchDbProducerTest.java index 7f43ef3..5fceae2 100644 --- a/components/camel-couchdb/src/test/java/org/apache/camel/component/couchdb/CouchDbProducerTest.java +++ b/components/camel-couchdb/src/test/java/org/apache/camel/component/couchdb/CouchDbProducerTest.java @@ -25,18 +25,19 @@ import org.apache.camel.InvalidPayloadException; import org.apache.camel.Message; import org.junit.Before; import org.junit.Test; +import org.junit.runner.RunWith; import org.lightcouch.Response; import org.mockito.Mock; import org.mockito.invocation.InvocationOnMock; +import org.mockito.junit.MockitoJUnitRunner; import org.mockito.stubbing.Answer; import static org.junit.Assert.assertTrue; -import static org.mockito.Matchers.any; -import static org.mockito.Matchers.anyObject; +import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; -import static org.mockito.MockitoAnnotations.initMocks; +@RunWith(MockitoJUnitRunner.class) public class CouchDbProducerTest { @Mock @@ -58,12 +59,10 @@ public class CouchDbProducerTest { @Before public void before() { - initMocks(this); producer = new CouchDbProducer(endpoint, client); when(exchange.getIn()).thenReturn(msg); } - @SuppressWarnings("unchecked") @Test(expected = InvalidPayloadException.class) public void testBodyMandatory() throws Exception { when(msg.getMandatoryBody()).thenThrow(InvalidPayloadException.class); @@ -89,7 +88,6 @@ public class CouchDbProducerTest { verify(msg).setHeader(CouchDbConstants.HEADER_DOC_REV, rev); } - @SuppressWarnings("unchecked") @Test(expected = InvalidPayloadException.class) public void testNullSaveResponseThrowsError() throws Exception { when(exchange.getIn().getMandatoryBody()).thenThrow(InvalidPayloadException.class); @@ -120,7 +118,7 @@ public class CouchDbProducerTest { @Test public void testStringBodyIsConvertedToJsonTree() throws Exception { when(msg.getMandatoryBody()).thenReturn("{ \"name\" : \"coldplay\" }"); - when(client.save(anyObject())).thenAnswer(new Answer<Response>() { + when(client.save(any())).thenAnswer(new Answer<Response>() { @Override public Response answer(InvocationOnMock invocation) throws Throwable { -- To stop receiving notification emails like this one, please contact ['"commits@camel.apache.org" <commits@camel.apache.org>'].