camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aldettin...@apache.org
Subject [camel] branch master updated: CAMEL-11869: Upgrade mockito-core to 2.11.0 for camel-reactive-streams, camel-printer, camel-rabbitmq and camel-aws
Date Thu, 09 Nov 2017 17:36:26 GMT
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 c1a7532  CAMEL-11869: Upgrade mockito-core to 2.11.0 for camel-reactive-streams, camel-printer, camel-rabbitmq and camel-aws
c1a7532 is described below

commit c1a7532fc396241f5f82d8f6fa46a45772eed37b
Author: aldettinger <aldettinger@gmail.com>
AuthorDate: Thu Nov 9 18:25:46 2017 +0100

    CAMEL-11869: Upgrade mockito-core to 2.11.0 for camel-reactive-streams, camel-printer, camel-rabbitmq and camel-aws
---
 components/camel-aws/pom.xml                       |   1 +
 .../aws/cw/CwComponentConfigurationTest.java       |   2 +-
 .../aws/ddbstream/DdbStreamConsumerTest.java       |  26 ++--
 .../aws/ddbstream/DdbStreamEndpointTest.java       |  15 ++-
 .../aws/ddbstream/ShardIteratorHandlerTest.java    |   5 +-
 .../component/aws/ec2/AmazonEC2ClientMock.java     |  20 +--
 .../aws/ec2/EC2ComponentConfigurationTest.java     |  19 ++-
 .../component/aws/ec2/EC2ComponentSpringTest.java  |  91 ++++++--------
 .../camel/component/aws/ec2/EC2ProducerTest.java   |  28 ++---
 .../integration/EC2ComponentIntegrationTest.java   |  77 ++++++------
 .../aws/firehose/KinesisFirehoseEndpointTest.java  |   2 +-
 .../aws/firehose/KinesisFirehoseProducerTest.java  |   6 +-
 .../component/aws/kinesis/KinesisConsumerTest.java |   3 +-
 .../component/aws/kinesis/KinesisEndpointTest.java |   2 +-
 .../component/aws/kinesis/KinesisProducerTest.java |   5 +-
 .../aws/lambda/LambdaComponentSpringTest.java      |  12 --
 .../aws/s3/AmazonS3EncryptionClientMock.java       |   2 -
 .../camel/component/aws/ses/MockMessage.java       |   7 +-
 .../component/aws/sqs/AmazonSQSClientMock.java     |   6 +-
 .../camel/component/aws/sqs/SqsEndpointTest.java   |   6 +-
 .../camel/component/aws/sqs/SqsProducerTest.java   | 137 +++++++++------------
 .../aws/swf/CamelSWFActivityClientTest.java        |  19 +--
 .../aws/swf/CamelSWFActivityConsumerTest.java      |   2 +-
 .../aws/swf/CamelSWFWorkflowClientTest.java        |   6 +-
 .../aws/swf/CamelSWFWorkflowConsumerTest.java      |   2 +-
 .../aws/swf/CamelSWFWorkflowProducerTest.java      |   2 +-
 components/camel-printer/pom.xml                   |   6 +-
 .../camel/component/printer/PrinterPrintTest.java  |   2 +-
 components/camel-rabbitmq/pom.xml                  |   3 +-
 .../component/rabbitmq/RabbitMQConsumerTest.java   |  13 +-
 .../component/rabbitmq/RabbitMQInOutIntTest.java   |   4 +-
 .../component/rabbitmq/RabbitMQLoadIntTest.java    |   4 +-
 .../rabbitmq/RabbitMQProducerIntTest.java          |   2 -
 .../component/rabbitmq/RabbitMQProducerTest.java   |   4 +-
 components/camel-reactive-streams/pom.xml          |   6 -
 .../reactive/streams/BasicSubscriberTest.java      |   1 -
 36 files changed, 245 insertions(+), 303 deletions(-)

diff --git a/components/camel-aws/pom.xml b/components/camel-aws/pom.xml
index 93fc263..c1533c1 100644
--- a/components/camel-aws/pom.xml
+++ b/components/camel-aws/pom.xml
@@ -150,6 +150,7 @@
         <dependency>
             <groupId>org.mockito</groupId>
             <artifactId>mockito-core</artifactId>
+            <version>${mockito2-version}</version>
             <scope>test</scope>
         </dependency>
     </dependencies>
diff --git a/components/camel-aws/src/test/java/org/apache/camel/component/aws/cw/CwComponentConfigurationTest.java b/components/camel-aws/src/test/java/org/apache/camel/component/aws/cw/CwComponentConfigurationTest.java
index 59dd982..d5db7e8 100644
--- a/components/camel-aws/src/test/java/org/apache/camel/component/aws/cw/CwComponentConfigurationTest.java
+++ b/components/camel-aws/src/test/java/org/apache/camel/component/aws/cw/CwComponentConfigurationTest.java
@@ -24,7 +24,7 @@ import org.apache.camel.impl.JndiRegistry;
 import org.apache.camel.test.junit4.CamelTestSupport;
 import org.junit.Test;
 
-import static org.mockito.Mockito.*;
+import static org.mockito.Mockito.mock;
 
 public class CwComponentConfigurationTest extends CamelTestSupport {
     private static final Date NOW = new Date();
diff --git a/components/camel-aws/src/test/java/org/apache/camel/component/aws/ddbstream/DdbStreamConsumerTest.java b/components/camel-aws/src/test/java/org/apache/camel/component/aws/ddbstream/DdbStreamConsumerTest.java
index 29340b9..051b53a 100644
--- a/components/camel-aws/src/test/java/org/apache/camel/component/aws/ddbstream/DdbStreamConsumerTest.java
+++ b/components/camel-aws/src/test/java/org/apache/camel/component/aws/ddbstream/DdbStreamConsumerTest.java
@@ -40,16 +40,15 @@ import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.mockito.ArgumentCaptor;
+import org.mockito.ArgumentMatchers;
 import org.mockito.Mock;
-import org.mockito.Mockito;
 import org.mockito.invocation.InvocationOnMock;
-import org.mockito.runners.MockitoJUnitRunner;
+import org.mockito.junit.MockitoJUnitRunner;
 import org.mockito.stubbing.Answer;
 
 import static org.hamcrest.CoreMatchers.is;
 import static org.junit.Assert.assertThat;
-import static org.mockito.Matchers.any;
-import static org.mockito.Matchers.anyString;
+import static org.mockito.ArgumentMatchers.any;
 import static org.mockito.Mockito.times;
 import static org.mockito.Mockito.verify;
 import static org.mockito.Mockito.when;
@@ -59,9 +58,13 @@ public class DdbStreamConsumerTest {
 
     private DdbStreamConsumer undertest;
 
-    @Mock private AmazonDynamoDBStreams amazonDynamoDBStreams;
-    @Mock private AsyncProcessor processor;
-    @Mock private ShardIteratorHandler shardIteratorHandler;
+    @Mock
+    private AmazonDynamoDBStreams amazonDynamoDBStreams;
+    @Mock
+    private AsyncProcessor processor;
+    @Mock
+    private ShardIteratorHandler shardIteratorHandler;
+
     private final CamelContext context = new DefaultCamelContext();
     private final DdbStreamComponent component = new DdbStreamComponent(context);
     private final DdbStreamEndpoint endpoint = new DdbStreamEndpoint(null, "table_name", component);
@@ -105,8 +108,8 @@ public class DdbStreamConsumerTest {
     @Test
     public void itResumesFromAfterTheLastSeenSequenceNumberWhenAShardIteratorHasExpired() throws Exception {
         endpoint.setIteratorType(ShardIteratorType.LATEST);
-        when(shardIteratorHandler.getShardIterator(anyString())).thenReturn("shard_iterator_b_000", "shard_iterator_b_001", "shard_iterator_b_001");
-        Mockito.reset(amazonDynamoDBStreams);
+        when(shardIteratorHandler.getShardIterator(ArgumentMatchers.isNull())).thenReturn("shard_iterator_b_000", "shard_iterator_b_001");
+        when(shardIteratorHandler.getShardIterator(ArgumentMatchers.anyString())).thenReturn("shard_iterator_b_001");
         when(amazonDynamoDBStreams.getRecords(any(GetRecordsRequest.class)))
                 .thenAnswer(recordsAnswer)
                 .thenThrow(new ExpiredIteratorException("expired shard"))
@@ -128,7 +131,7 @@ public class DdbStreamConsumerTest {
     public void atSeqNumber35GivesFirstRecordWithSeq35() throws Exception {
         endpoint.setIteratorType(ShardIteratorType.AT_SEQUENCE_NUMBER);
         endpoint.setSequenceNumberProvider(new StaticSequenceNumberProvider("35"));
-        when(shardIteratorHandler.getShardIterator(anyString())).thenReturn("shard_iterator_d_001", "shard_iterator_d_002");
+        when(shardIteratorHandler.getShardIterator(ArgumentMatchers.isNull())).thenReturn("shard_iterator_d_001", "shard_iterator_d_002");
 
         for (int i = 0; i < 10; ++i) { // poll lots.
             undertest.poll();
@@ -145,7 +148,7 @@ public class DdbStreamConsumerTest {
     public void afterSeqNumber35GivesFirstRecordWithSeq40() throws Exception {
         endpoint.setIteratorType(ShardIteratorType.AFTER_SEQUENCE_NUMBER);
         endpoint.setSequenceNumberProvider(new StaticSequenceNumberProvider("35"));
-        when(shardIteratorHandler.getShardIterator(anyString())).thenReturn("shard_iterator_d_001", "shard_iterator_d_002");
+        when(shardIteratorHandler.getShardIterator(ArgumentMatchers.isNull())).thenReturn("shard_iterator_d_001", "shard_iterator_d_002");
 
         for (int i = 0; i < 10; ++i) { // poll lots.
             undertest.poll();
@@ -201,5 +204,4 @@ public class DdbStreamConsumerTest {
                     .withNextShardIterator(nextShardIterator);
         }
     }
-    
 }
\ No newline at end of file
diff --git a/components/camel-aws/src/test/java/org/apache/camel/component/aws/ddbstream/DdbStreamEndpointTest.java b/components/camel-aws/src/test/java/org/apache/camel/component/aws/ddbstream/DdbStreamEndpointTest.java
index 1d3629e..342e99f 100644
--- a/components/camel-aws/src/test/java/org/apache/camel/component/aws/ddbstream/DdbStreamEndpointTest.java
+++ b/components/camel-aws/src/test/java/org/apache/camel/component/aws/ddbstream/DdbStreamEndpointTest.java
@@ -26,7 +26,7 @@ import org.junit.Test;
 import org.junit.rules.ExpectedException;
 import org.junit.runner.RunWith;
 import org.mockito.Mock;
-import org.mockito.runners.MockitoJUnitRunner;
+import org.mockito.junit.MockitoJUnitRunner;
 
 import static org.hamcrest.CoreMatchers.containsString;
 import static org.hamcrest.CoreMatchers.is;
@@ -37,12 +37,15 @@ import static org.mockito.Mockito.when;
 
 @RunWith(MockitoJUnitRunner.class)
 public class DdbStreamEndpointTest {
-    @Rule public ExpectedException expectedException = ExpectedException.none();
+    @Rule
+    public ExpectedException expectedException = ExpectedException.none();
 
     private CamelContext context;
 
-    @Mock private SequenceNumberProvider sequenceNumberProvider;
-    @Mock private AmazonDynamoDBStreams amazonDynamoDBStreams;
+    @Mock
+    private SequenceNumberProvider sequenceNumberProvider;
+    @Mock
+    private AmazonDynamoDBStreams amazonDynamoDBStreams;
 
     @Before
     public void setup() throws Exception {
@@ -78,8 +81,6 @@ public class DdbStreamEndpointTest {
 
     @Test
     public void onSequenceNumberAgnosticIteratorsTheProviderIsIgnored() throws Exception {
-        when(sequenceNumberProvider.getSequenceNumber()).thenReturn("seq");
-
         DdbStreamEndpoint undertest = (DdbStreamEndpoint)context.getEndpoint("aws-ddbstream://table"
                 + "?amazonDynamoDbStreamsClient=#ddbStreamsClient"
                 + "&iteratorType=LATEST"
@@ -91,8 +92,6 @@ public class DdbStreamEndpointTest {
 
     @Test
     public void sequenceNumberFetchingThrowsSomethingUsefulIfMisconfigurered() throws Exception {
-        when(sequenceNumberProvider.getSequenceNumber()).thenReturn("seq");
-
         expectedException.expectMessage(containsString("sequenceNumberProvider"));
 
         DdbStreamEndpoint undertest = (DdbStreamEndpoint)context.getEndpoint("aws-ddbstream://table"
diff --git a/components/camel-aws/src/test/java/org/apache/camel/component/aws/ddbstream/ShardIteratorHandlerTest.java b/components/camel-aws/src/test/java/org/apache/camel/component/aws/ddbstream/ShardIteratorHandlerTest.java
index 6239baf..e247990 100644
--- a/components/camel-aws/src/test/java/org/apache/camel/component/aws/ddbstream/ShardIteratorHandlerTest.java
+++ b/components/camel-aws/src/test/java/org/apache/camel/component/aws/ddbstream/ShardIteratorHandlerTest.java
@@ -34,7 +34,7 @@ import org.junit.runner.RunWith;
 import org.mockito.ArgumentCaptor;
 import org.mockito.Mock;
 import org.mockito.invocation.InvocationOnMock;
-import org.mockito.runners.MockitoJUnitRunner;
+import org.mockito.junit.MockitoJUnitRunner;
 import org.mockito.stubbing.Answer;
 
 import static org.hamcrest.CoreMatchers.is;
@@ -46,7 +46,8 @@ public class ShardIteratorHandlerTest {
 
     private ShardIteratorHandler undertest;
 
-    @Mock private AmazonDynamoDBStreams amazonDynamoDBStreams;
+    @Mock
+    private AmazonDynamoDBStreams amazonDynamoDBStreams;
     private final CamelContext context = new DefaultCamelContext();
     private final DdbStreamComponent component = new DdbStreamComponent(context);
     private final DdbStreamEndpoint endpoint = new DdbStreamEndpoint(null, "table_name", component);
diff --git a/components/camel-aws/src/test/java/org/apache/camel/component/aws/ec2/AmazonEC2ClientMock.java b/components/camel-aws/src/test/java/org/apache/camel/component/aws/ec2/AmazonEC2ClientMock.java
index 07729a8..a8689e7 100644
--- a/components/camel-aws/src/test/java/org/apache/camel/component/aws/ec2/AmazonEC2ClientMock.java
+++ b/components/camel-aws/src/test/java/org/apache/camel/component/aws/ec2/AmazonEC2ClientMock.java
@@ -73,7 +73,7 @@ public class AmazonEC2ClientMock extends AmazonEC2Client {
             res.setOwnerId("1");
             res.setRequesterId("user-test");
             res.setReservationId("res-1");
-            Collection<Instance> instances = new ArrayList();
+            Collection<Instance> instances = new ArrayList<>();
             Instance ins = new Instance();
             ins.setImageId(runInstancesRequest.getImageId());
             ins.setInstanceType(runInstancesRequest.getInstanceType());
@@ -86,7 +86,7 @@ public class AmazonEC2ClientMock extends AmazonEC2Client {
                     GroupIdentifier id2 = new GroupIdentifier();
                     id2.setGroupId("id-2");
                     id2.setGroupName("secgroup-2");
-                    Collection secGroups = new ArrayList<GroupIdentifier>();
+                    Collection<GroupIdentifier> secGroups = new ArrayList<>();
                     secGroups.add(id1);
                     secGroups.add(id2);
                     ins.setSecurityGroups(secGroups);
@@ -98,7 +98,7 @@ public class AmazonEC2ClientMock extends AmazonEC2Client {
                         GroupIdentifier id2 = new GroupIdentifier();
                         id2.setGroupId("id-4");
                         id2.setGroupName("secgroup-4");
-                        Collection secGroups = new ArrayList<GroupIdentifier>();
+                        Collection<GroupIdentifier> secGroups = new ArrayList<>();
                         secGroups.add(id1);
                         secGroups.add(id2);
                         ins.setSecurityGroups(secGroups);
@@ -193,7 +193,7 @@ public class AmazonEC2ClientMock extends AmazonEC2Client {
             res.setOwnerId("1");
             res.setRequesterId("user-test");
             res.setReservationId("res-1");
-            Collection<Instance> instances = new ArrayList();
+            Collection<Instance> instances = new ArrayList<>();
             Instance ins = new Instance();
             ins.setImageId("id-1");
             ins.setInstanceType(InstanceType.T2Micro);
@@ -214,7 +214,7 @@ public class AmazonEC2ClientMock extends AmazonEC2Client {
                 res.setOwnerId("1");
                 res.setRequesterId("user-test");
                 res.setReservationId("res-1");
-                Collection<Instance> instances = new ArrayList();
+                Collection<Instance> instances = new ArrayList<>();
                 Instance ins = new Instance();
                 ins.setImageId("id-1");
                 ins.setInstanceType(InstanceType.T2Micro);
@@ -231,7 +231,7 @@ public class AmazonEC2ClientMock extends AmazonEC2Client {
     @Override
     public DescribeInstanceStatusResult describeInstanceStatus(DescribeInstanceStatusRequest describeInstanceStatusRequest) {
         DescribeInstanceStatusResult result = new DescribeInstanceStatusResult();
-        Collection<InstanceStatus> instanceStatuses = new ArrayList();
+        Collection<InstanceStatus> instanceStatuses = new ArrayList<>();
         if (describeInstanceStatusRequest.getInstanceIds().isEmpty()) {
             InstanceStatus status = new InstanceStatus();
             status.setInstanceId("test-1");
@@ -267,8 +267,8 @@ public class AmazonEC2ClientMock extends AmazonEC2Client {
     public MonitorInstancesResult monitorInstances(MonitorInstancesRequest monitorInstancesRequest) {
         MonitorInstancesResult result = new MonitorInstancesResult();
         if (!monitorInstancesRequest.getInstanceIds().isEmpty()) {
-            Collection<InstanceMonitoring> coll = new ArrayList();
-            Iterator it = monitorInstancesRequest.getInstanceIds().iterator();
+            Collection<InstanceMonitoring> coll = new ArrayList<>();
+            Iterator<String> it = monitorInstancesRequest.getInstanceIds().iterator();
             while (it.hasNext()) {
                 String id = (String) it.next();
                 InstanceMonitoring mon = new InstanceMonitoring();
@@ -287,8 +287,8 @@ public class AmazonEC2ClientMock extends AmazonEC2Client {
     public UnmonitorInstancesResult unmonitorInstances(UnmonitorInstancesRequest unmonitorInstancesRequest) {
         UnmonitorInstancesResult result = new UnmonitorInstancesResult();
         if (!unmonitorInstancesRequest.getInstanceIds().isEmpty()) {
-            Collection<InstanceMonitoring> coll = new ArrayList();
-            Iterator it = unmonitorInstancesRequest.getInstanceIds().iterator();
+            Collection<InstanceMonitoring> coll = new ArrayList<>();
+            Iterator<String> it = unmonitorInstancesRequest.getInstanceIds().iterator();
             while (it.hasNext()) {
                 String id = (String) it.next();
                 InstanceMonitoring mon = new InstanceMonitoring();
diff --git a/components/camel-aws/src/test/java/org/apache/camel/component/aws/ec2/EC2ComponentConfigurationTest.java b/components/camel-aws/src/test/java/org/apache/camel/component/aws/ec2/EC2ComponentConfigurationTest.java
index 321de67..ac7da91 100644
--- a/components/camel-aws/src/test/java/org/apache/camel/component/aws/ec2/EC2ComponentConfigurationTest.java
+++ b/components/camel-aws/src/test/java/org/apache/camel/component/aws/ec2/EC2ComponentConfigurationTest.java
@@ -17,34 +17,31 @@
 package org.apache.camel.component.aws.ec2;
 
 import com.amazonaws.services.ec2.AmazonEC2Client;
+
 import org.apache.camel.impl.JndiRegistry;
 import org.apache.camel.test.junit4.CamelTestSupport;
 import org.junit.Test;
 
-import static org.mockito.Mockito.*;
-
-
+import static org.mockito.Mockito.mock;
 
 public class EC2ComponentConfigurationTest extends CamelTestSupport {
     AmazonEC2Client amazonEc2Client = mock(AmazonEC2Client.class);
+
     @Test
     public void createEndpointWithMinimalConfiguration() throws Exception {
         EC2Component component = new EC2Component(context);
-        EC2Endpoint endpoint = (EC2Endpoint) component.createEndpoint(
-                "aws-ec2://TestDomain?amazonEc2Client=#amazonEc2Client&accessKey=xxx&secretKey=yyy");
+        EC2Endpoint endpoint = (EC2Endpoint)component.createEndpoint("aws-ec2://TestDomain?amazonEc2Client=#amazonEc2Client&accessKey=xxx&secretKey=yyy");
         
         assertEquals("xxx", endpoint.getConfiguration().getAccessKey());
         assertEquals("yyy", endpoint.getConfiguration().getSecretKey());
         assertNotNull(endpoint.getConfiguration().getAmazonEc2Client());
     }
-
-
+    
     @Test
     public void createEndpointWithOnlyAccessKeyAndSecretKey() throws Exception {
         EC2Component component = new EC2Component(context);
-        EC2Endpoint endpoint = (EC2Endpoint) component.createEndpoint(
-            "aws-ec2://TestDomain?accessKey=xxx&secretKey=yyy");
-
+        EC2Endpoint endpoint = (EC2Endpoint)component.createEndpoint("aws-ec2://TestDomain?accessKey=xxx&secretKey=yyy");
+        
         assertEquals("xxx", endpoint.getConfiguration().getAccessKey());
         assertEquals("yyy", endpoint.getConfiguration().getSecretKey());
         assertNull(endpoint.getConfiguration().getAmazonEc2Client());
@@ -86,4 +83,4 @@ public class EC2ComponentConfigurationTest extends CamelTestSupport {
         registry.bind("amazonEc2Client", amazonEc2Client);
         return registry;
     }
-}
\ No newline at end of file
+}
diff --git a/components/camel-aws/src/test/java/org/apache/camel/component/aws/ec2/EC2ComponentSpringTest.java b/components/camel-aws/src/test/java/org/apache/camel/component/aws/ec2/EC2ComponentSpringTest.java
index 7341fa5..7163543 100644
--- a/components/camel-aws/src/test/java/org/apache/camel/component/aws/ec2/EC2ComponentSpringTest.java
+++ b/components/camel-aws/src/test/java/org/apache/camel/component/aws/ec2/EC2ComponentSpringTest.java
@@ -34,23 +34,12 @@ import com.amazonaws.services.ec2.model.UnmonitorInstancesResult;
 import org.apache.camel.Exchange;
 import org.apache.camel.Processor;
 import org.apache.camel.test.spring.CamelSpringTestSupport;
-import org.junit.Before;
 import org.junit.Test;
 import org.springframework.context.support.AbstractApplicationContext;
 import org.springframework.context.support.ClassPathXmlApplicationContext;
 
 public class EC2ComponentSpringTest extends CamelSpringTestSupport {
-    
-    private AmazonEC2ClientMock amazonEc2Client;
-    
-    @Override
-    @Before
-    public void setUp() throws Exception {
-        super.setUp();
-        
-        amazonEc2Client = context.getRegistry().lookupByNameAndType("amazonEC2Client", AmazonEC2ClientMock.class);
-    }
-    
+
     @Test
     public void createAndRunInstances() {
         
@@ -64,7 +53,7 @@ public class EC2ComponentSpringTest extends CamelSpringTestSupport {
             }
         });
         
-        RunInstancesResult resultGet = (RunInstancesResult) exchange.getOut().getBody();
+        RunInstancesResult resultGet = (RunInstancesResult)exchange.getOut().getBody();
         assertEquals(resultGet.getReservation().getInstances().get(0).getImageId(), "test-1");
         assertEquals(resultGet.getReservation().getInstances().get(0).getInstanceType(), InstanceType.T2Micro.toString());
         assertEquals(resultGet.getReservation().getInstances().get(0).getInstanceId(), "instance-1");
@@ -72,7 +61,7 @@ public class EC2ComponentSpringTest extends CamelSpringTestSupport {
     
     @Test
     public void ec2CreateAndRunTestWithKeyPair() throws Exception {
-
+        
         Exchange exchange = template.request("direct:createAndRun", new Processor() {
             @Override
             public void process(Exchange exchange) throws Exception {
@@ -85,7 +74,7 @@ public class EC2ComponentSpringTest extends CamelSpringTestSupport {
             }
         });
         
-        RunInstancesResult resultGet = (RunInstancesResult) exchange.getOut().getBody();
+        RunInstancesResult resultGet = (RunInstancesResult)exchange.getOut().getBody();
         assertEquals(resultGet.getReservation().getInstances().get(0).getImageId(), "test-1");
         assertEquals(resultGet.getReservation().getInstances().get(0).getInstanceType(), InstanceType.T2Micro.toString());
         assertEquals(resultGet.getReservation().getInstances().get(0).getInstanceId(), "instance-1");
@@ -100,13 +89,13 @@ public class EC2ComponentSpringTest extends CamelSpringTestSupport {
         Exchange exchange = template.request("direct:start", new Processor() {
             @Override
             public void process(Exchange exchange) throws Exception {
-                Collection l = new ArrayList();
+                Collection<String> l = new ArrayList<>();
                 l.add("test-1");
-                exchange.getIn().setHeader(EC2Constants.INSTANCES_IDS, l);   
+                exchange.getIn().setHeader(EC2Constants.INSTANCES_IDS, l);
             }
         });
-                
-        StartInstancesResult resultGet = (StartInstancesResult) exchange.getOut().getBody();
+        
+        StartInstancesResult resultGet = (StartInstancesResult)exchange.getOut().getBody();
         assertEquals(resultGet.getStartingInstances().get(0).getInstanceId(), "test-1");
         assertEquals(resultGet.getStartingInstances().get(0).getPreviousState().getName(), InstanceStateName.Stopped.toString());
         assertEquals(resultGet.getStartingInstances().get(0).getCurrentState().getName(), InstanceStateName.Running.toString());
@@ -118,31 +107,31 @@ public class EC2ComponentSpringTest extends CamelSpringTestSupport {
         Exchange exchange = template.request("direct:stop", new Processor() {
             @Override
             public void process(Exchange exchange) throws Exception {
-                Collection l = new ArrayList();
+                Collection<String> l = new ArrayList<>();
                 l.add("test-1");
-                exchange.getIn().setHeader(EC2Constants.INSTANCES_IDS, l);   
+                exchange.getIn().setHeader(EC2Constants.INSTANCES_IDS, l);
             }
         });
-                
-        StopInstancesResult resultGet = (StopInstancesResult) exchange.getOut().getBody();
+        
+        StopInstancesResult resultGet = (StopInstancesResult)exchange.getOut().getBody();
         assertEquals(resultGet.getStoppingInstances().get(0).getInstanceId(), "test-1");
         assertEquals(resultGet.getStoppingInstances().get(0).getPreviousState().getName(), InstanceStateName.Running.toString());
         assertEquals(resultGet.getStoppingInstances().get(0).getCurrentState().getName(), InstanceStateName.Stopped.toString());
     }
-
+    
     @Test
     public void terminateInstances() {
         
         Exchange exchange = template.request("direct:terminate", new Processor() {
             @Override
             public void process(Exchange exchange) throws Exception {
-                Collection l = new ArrayList();
+                Collection<String> l = new ArrayList<>();
                 l.add("test-1");
-                exchange.getIn().setHeader(EC2Constants.INSTANCES_IDS, l);   
+                exchange.getIn().setHeader(EC2Constants.INSTANCES_IDS, l);
             }
         });
-                
-        TerminateInstancesResult resultGet = (TerminateInstancesResult) exchange.getOut().getBody();
+        
+        TerminateInstancesResult resultGet = (TerminateInstancesResult)exchange.getOut().getBody();
         assertEquals(resultGet.getTerminatingInstances().get(0).getInstanceId(), "test-1");
         assertEquals(resultGet.getTerminatingInstances().get(0).getPreviousState().getName(), InstanceStateName.Running.toString());
         assertEquals(resultGet.getTerminatingInstances().get(0).getCurrentState().getName(), InstanceStateName.Terminated.toString());
@@ -150,71 +139,70 @@ public class EC2ComponentSpringTest extends CamelSpringTestSupport {
     
     @Test
     public void ec2DescribeSpecificInstancesTest() throws Exception {
-
+        
         Exchange exchange = template.request("direct:describe", new Processor() {
             
             @Override
             public void process(Exchange exchange) throws Exception {
-                Collection l = new ArrayList();
+                Collection<String> l = new ArrayList<>();
                 l.add("instance-1");
-                exchange.getIn().setHeader(EC2Constants.INSTANCES_IDS, l);   
+                exchange.getIn().setHeader(EC2Constants.INSTANCES_IDS, l);
             }
         });
         
-        DescribeInstancesResult resultGet = (DescribeInstancesResult) exchange.getOut().getBody();
+        DescribeInstancesResult resultGet = (DescribeInstancesResult)exchange.getOut().getBody();
         assertEquals(resultGet.getReservations().size(), 1);
         assertEquals(resultGet.getReservations().get(0).getInstances().size(), 1);
     }
     
     @Test
     public void ec2DescribeStatusSpecificInstancesTest() throws Exception {
-
+        
         Exchange exchange = template.request("direct:describeStatus", new Processor() {
             
             @Override
             public void process(Exchange exchange) throws Exception {
-                Collection l = new ArrayList();
+                Collection<String> l = new ArrayList<>();
                 l.add("test-1");
-                exchange.getIn().setHeader(EC2Constants.INSTANCES_IDS, l);   
+                exchange.getIn().setHeader(EC2Constants.INSTANCES_IDS, l);
             }
         });
         
         assertMockEndpointsSatisfied();
         
-        DescribeInstanceStatusResult resultGet = (DescribeInstanceStatusResult) exchange.getOut().getBody();
+        DescribeInstanceStatusResult resultGet = (DescribeInstanceStatusResult)exchange.getOut().getBody();
         assertEquals(resultGet.getInstanceStatuses().size(), 1);
         assertEquals(resultGet.getInstanceStatuses().get(0).getInstanceState().getName(), InstanceStateName.Running.toString());
     }
     
     @Test
     public void ec2RebootInstancesTest() throws Exception {
-
-        Exchange exchange = template.request("direct:reboot", new Processor() {
+        
+        template.request("direct:reboot", new Processor() {
             
             @Override
             public void process(Exchange exchange) throws Exception {
-                Collection l = new ArrayList();
+                Collection<String> l = new ArrayList<>();
                 l.add("test-1");
-                exchange.getIn().setHeader(EC2Constants.INSTANCES_IDS, l);   
+                exchange.getIn().setHeader(EC2Constants.INSTANCES_IDS, l);
             }
         });
-        
     }
     
     @Test
     public void ec2MonitorInstancesTest() throws Exception {
-
+        
         Exchange exchange = template.request("direct:monitor", new Processor() {
             
             @Override
             public void process(Exchange exchange) throws Exception {
-                Collection l = new ArrayList();
+                Collection<String> l = new ArrayList<>();
                 l.add("test-1");
-                exchange.getIn().setHeader(EC2Constants.INSTANCES_IDS, l);   
+                exchange.getIn().setHeader(EC2Constants.INSTANCES_IDS, l);
             }
         });
         
-        MonitorInstancesResult resultGet = (MonitorInstancesResult) exchange.getOut().getBody();
+        MonitorInstancesResult resultGet = (MonitorInstancesResult)exchange.getOut().getBody();
         
         assertEquals(resultGet.getInstanceMonitorings().size(), 1);
         assertEquals(resultGet.getInstanceMonitorings().get(0).getInstanceId(), "test-1");
@@ -223,18 +211,18 @@ public class EC2ComponentSpringTest extends CamelSpringTestSupport {
     
     @Test
     public void ec2UnmonitorInstancesTest() throws Exception {
-
+        
         Exchange exchange = template.request("direct:unmonitor", new Processor() {
             
             @Override
             public void process(Exchange exchange) throws Exception {
-                Collection l = new ArrayList();
+                Collection<String> l = new ArrayList<>();
                 l.add("test-1");
-                exchange.getIn().setHeader(EC2Constants.INSTANCES_IDS, l);   
+                exchange.getIn().setHeader(EC2Constants.INSTANCES_IDS, l);
             }
         });
         
-        UnmonitorInstancesResult resultGet = (UnmonitorInstancesResult) exchange.getOut().getBody();
+        UnmonitorInstancesResult resultGet = (UnmonitorInstancesResult)exchange.getOut().getBody();
         
         assertEquals(resultGet.getInstanceMonitorings().size(), 1);
         assertEquals(resultGet.getInstanceMonitorings().get(0).getInstanceId(), "test-1");
@@ -243,7 +231,6 @@ public class EC2ComponentSpringTest extends CamelSpringTestSupport {
     
     @Override
     protected AbstractApplicationContext createApplicationContext() {
-        return new ClassPathXmlApplicationContext(
-                "org/apache/camel/component/aws/ec2/EC2ComponentSpringTest-context.xml");
+        return new ClassPathXmlApplicationContext("org/apache/camel/component/aws/ec2/EC2ComponentSpringTest-context.xml");
     }
-}
\ No newline at end of file
+}
diff --git a/components/camel-aws/src/test/java/org/apache/camel/component/aws/ec2/EC2ProducerTest.java b/components/camel-aws/src/test/java/org/apache/camel/component/aws/ec2/EC2ProducerTest.java
index 896e2a3..39f7997 100644
--- a/components/camel-aws/src/test/java/org/apache/camel/component/aws/ec2/EC2ProducerTest.java
+++ b/components/camel-aws/src/test/java/org/apache/camel/component/aws/ec2/EC2ProducerTest.java
@@ -215,7 +215,7 @@ public class EC2ProducerTest extends CamelTestSupport {
     public void ec2CreateAndRunKoTest() throws Exception {
 
         mock.expectedMessageCount(0);
-        Exchange exchange = template.request("direct:createAndRun", new Processor() {
+        template.request("direct:createAndRun", new Processor() {
             @Override
             public void process(Exchange exchange) throws Exception {
                 exchange.getIn().setHeader(EC2Constants.OPERATION, EC2Operations.createAndRunInstances);
@@ -237,7 +237,7 @@ public class EC2ProducerTest extends CamelTestSupport {
         Exchange exchange = template.request("direct:start", new Processor() {
             @Override
             public void process(Exchange exchange) throws Exception {
-                Collection l = new ArrayList();
+                Collection<String> l = new ArrayList<>();
                 l.add("test-1");
                 exchange.getIn().setHeader(EC2Constants.INSTANCES_IDS, l);   
             }
@@ -258,7 +258,7 @@ public class EC2ProducerTest extends CamelTestSupport {
         Exchange exchange = template.request("direct:stop", new Processor() {
             @Override
             public void process(Exchange exchange) throws Exception {
-                Collection l = new ArrayList();
+                Collection<String> l = new ArrayList<>();
                 l.add("test-1");
                 exchange.getIn().setHeader(EC2Constants.INSTANCES_IDS, l);   
             }
@@ -280,7 +280,7 @@ public class EC2ProducerTest extends CamelTestSupport {
         Exchange exchange = template.request("direct:terminate", new Processor() {
             @Override
             public void process(Exchange exchange) throws Exception {
-                Collection l = new ArrayList();
+                Collection<String> l = new ArrayList<>();
                 l.add("test-1");
                 exchange.getIn().setHeader(EC2Constants.INSTANCES_IDS, l);   
             }
@@ -321,7 +321,7 @@ public class EC2ProducerTest extends CamelTestSupport {
             
             @Override
             public void process(Exchange exchange) throws Exception {
-                Collection l = new ArrayList();
+                Collection<String> l = new ArrayList<>();
                 l.add("instance-1");
                 exchange.getIn().setHeader(EC2Constants.INSTANCES_IDS, l);   
             }
@@ -360,7 +360,7 @@ public class EC2ProducerTest extends CamelTestSupport {
             
             @Override
             public void process(Exchange exchange) throws Exception {
-                Collection l = new ArrayList();
+                Collection<String> l = new ArrayList<>();
                 l.add("test-1");
                 exchange.getIn().setHeader(EC2Constants.INSTANCES_IDS, l);   
             }
@@ -377,11 +377,11 @@ public class EC2ProducerTest extends CamelTestSupport {
     public void ec2RebootInstancesTest() throws Exception {
 
         mock.expectedMessageCount(1);
-        Exchange exchange = template.request("direct:reboot", new Processor() {
+        template.request("direct:reboot", new Processor() {
             
             @Override
             public void process(Exchange exchange) throws Exception {
-                Collection l = new ArrayList();
+                Collection<String> l = new ArrayList<>();
                 l.add("test-1");
                 exchange.getIn().setHeader(EC2Constants.INSTANCES_IDS, l);   
             }
@@ -399,7 +399,7 @@ public class EC2ProducerTest extends CamelTestSupport {
             
             @Override
             public void process(Exchange exchange) throws Exception {
-                Collection l = new ArrayList();
+                Collection<String> l = new ArrayList<>();
                 l.add("test-1");
                 exchange.getIn().setHeader(EC2Constants.INSTANCES_IDS, l);   
             }
@@ -422,7 +422,7 @@ public class EC2ProducerTest extends CamelTestSupport {
             
             @Override
             public void process(Exchange exchange) throws Exception {
-                Collection l = new ArrayList();
+                Collection<String> l = new ArrayList<>();
                 l.add("test-1");
                 exchange.getIn().setHeader(EC2Constants.INSTANCES_IDS, l);   
             }
@@ -445,10 +445,10 @@ public class EC2ProducerTest extends CamelTestSupport {
             
             @Override
             public void process(Exchange exchange) throws Exception {
-                Collection l = new ArrayList();
+                Collection<String> l = new ArrayList<>();
                 l.add("test-1");
                 exchange.getIn().setHeader(EC2Constants.INSTANCES_IDS, l);
-                Collection tags = new ArrayList();
+                Collection<String> tags = new ArrayList<>();
                 tags.add("pacific");
                 exchange.getIn().setHeader(EC2Constants.INSTANCES_TAGS, tags);
             }
@@ -469,10 +469,10 @@ public class EC2ProducerTest extends CamelTestSupport {
             
             @Override
             public void process(Exchange exchange) throws Exception {
-                Collection l = new ArrayList();
+                Collection<String> l = new ArrayList<>();
                 l.add("test-1");
                 exchange.getIn().setHeader(EC2Constants.INSTANCES_IDS, l);
-                Collection tags = new ArrayList();
+                Collection<String> tags = new ArrayList<>();
                 tags.add("pacific");
                 exchange.getIn().setHeader(EC2Constants.INSTANCES_TAGS, tags);
             }
diff --git a/components/camel-aws/src/test/java/org/apache/camel/component/aws/ec2/integration/EC2ComponentIntegrationTest.java b/components/camel-aws/src/test/java/org/apache/camel/component/aws/ec2/integration/EC2ComponentIntegrationTest.java
index b0dd3fc..49212f4 100644
--- a/components/camel-aws/src/test/java/org/apache/camel/component/aws/ec2/integration/EC2ComponentIntegrationTest.java
+++ b/components/camel-aws/src/test/java/org/apache/camel/component/aws/ec2/integration/EC2ComponentIntegrationTest.java
@@ -32,7 +32,7 @@ import org.junit.Test;
 
 @Ignore("Must be manually tested. Provide your own accessKey and secretKey!")
 public class EC2ComponentIntegrationTest extends CamelTestSupport {
-    
+
     @Test
     public void createAndRunInstancesTest() {
         
@@ -41,7 +41,7 @@ public class EC2ComponentIntegrationTest extends CamelTestSupport {
                 exchange.getIn().setHeader(EC2Constants.IMAGE_ID, "ami-fd65ba94");
                 exchange.getIn().setHeader(EC2Constants.INSTANCE_TYPE, InstanceType.T2Micro);
                 exchange.getIn().setHeader(EC2Constants.INSTANCE_MIN_COUNT, 1); 
-                exchange.getIn().setHeader(EC2Constants.INSTANCE_MAX_COUNT, 1);               
+                exchange.getIn().setHeader(EC2Constants.INSTANCE_MAX_COUNT, 1);
             }
         });
     }
@@ -65,8 +65,8 @@ public class EC2ComponentIntegrationTest extends CamelTestSupport {
     
     @Test
     public void ec2CreateAndRunTestWithKeyPair() throws Exception {
-
-        Exchange exchange = template.request("direct:createAndRun", new Processor() {
+        
+        template.request("direct:createAndRun", new Processor() {
             @Override
             public void process(Exchange exchange) throws Exception {
                 exchange.getIn().setHeader(EC2Constants.OPERATION, EC2Operations.createAndRunInstances);
@@ -84,9 +84,9 @@ public class EC2ComponentIntegrationTest extends CamelTestSupport {
         
         template.send("direct:stop", new Processor() {
             public void process(Exchange exchange) throws Exception {
-                Collection l = new ArrayList();
+                Collection<String> l = new ArrayList<>();
                 l.add("test-1");
-                exchange.getIn().setHeader(EC2Constants.INSTANCES_IDS, l);            
+                exchange.getIn().setHeader(EC2Constants.INSTANCES_IDS, l);
             }
         });
     }
@@ -96,9 +96,9 @@ public class EC2ComponentIntegrationTest extends CamelTestSupport {
         
         template.send("direct:start", new Processor() {
             public void process(Exchange exchange) throws Exception {
-                Collection l = new ArrayList();
+                Collection<String> l = new ArrayList<>();
                 l.add("test-1");
-                exchange.getIn().setHeader(EC2Constants.INSTANCES_IDS, l);            
+                exchange.getIn().setHeader(EC2Constants.INSTANCES_IDS, l);
             }
         });
     }
@@ -108,114 +108,107 @@ public class EC2ComponentIntegrationTest extends CamelTestSupport {
         
         template.send("direct:terminate", new Processor() {
             public void process(Exchange exchange) throws Exception {
-                Collection l = new ArrayList();
+                Collection<String> l = new ArrayList<>();
                 l.add("test-1");
-                exchange.getIn().setHeader(EC2Constants.INSTANCES_IDS, l);            
+                exchange.getIn().setHeader(EC2Constants.INSTANCES_IDS, l);
             }
         });
     }
     
     @Test
     public void ec2DescribeInstancesTest() throws Exception {
-
-        Exchange exchange = template.request("direct:describe", new Processor() {
+        
+        template.request("direct:describe", new Processor() {
             
             @Override
             public void process(Exchange exchange) throws Exception {
                 
             }
         });
-
     }
     
     @Test
     public void ec2DescribeSpecificInstancesTest() throws Exception {
-
-        Exchange exchange = template.request("direct:describe", new Processor() {
+        
+        template.request("direct:describe", new Processor() {
             
             @Override
             public void process(Exchange exchange) throws Exception {
-                Collection l = new ArrayList();
+                Collection<String> l = new ArrayList<>();
                 l.add("instance-1");
-                exchange.getIn().setHeader(EC2Constants.INSTANCES_IDS, l);   
+                exchange.getIn().setHeader(EC2Constants.INSTANCES_IDS, l);
             }
         });
-
     }
     
     @Test
     public void ec2DescribeInstancesStatusTest() throws Exception {
-
-        Exchange exchange = template.request("direct:describeStatus", new Processor() {
+        
+        template.request("direct:describeStatus", new Processor() {
             
             @Override
             public void process(Exchange exchange) throws Exception {
                 
             }
         });
-
     }
     
     @Test
     public void ec2DescribeStatusSpecificInstancesTest() throws Exception {
-
-        Exchange exchange = template.request("direct:describeStatus", new Processor() {
+        
+        template.request("direct:describeStatus", new Processor() {
             
             @Override
             public void process(Exchange exchange) throws Exception {
-                Collection l = new ArrayList();
+                Collection<String> l = new ArrayList<>();
                 l.add("test-1");
-                exchange.getIn().setHeader(EC2Constants.INSTANCES_IDS, l);   
+                exchange.getIn().setHeader(EC2Constants.INSTANCES_IDS, l);
             }
         });
-
     }
     
     @Test
     public void ec2RebootInstancesTest() throws Exception {
-
-        Exchange exchange = template.request("direct:reboot", new Processor() {
+        
+        template.request("direct:reboot", new Processor() {
             
             @Override
             public void process(Exchange exchange) throws Exception {
-                Collection l = new ArrayList();
+                Collection<String> l = new ArrayList<>();
                 l.add("test-1");
-                exchange.getIn().setHeader(EC2Constants.INSTANCES_IDS, l);   
+                exchange.getIn().setHeader(EC2Constants.INSTANCES_IDS, l);
             }
         });
-
     }
     
-    
     @Test
     public void ec2MonitorInstancesTest() throws Exception {
-
-        Exchange exchange = template.request("direct:monitor", new Processor() {
+        
+        template.request("direct:monitor", new Processor() {
             
             @Override
             public void process(Exchange exchange) throws Exception {
-                Collection l = new ArrayList();
+                Collection<String> l = new ArrayList<>();
                 l.add("test-1");
-                exchange.getIn().setHeader(EC2Constants.INSTANCES_IDS, l);   
+                exchange.getIn().setHeader(EC2Constants.INSTANCES_IDS, l);
             }
         });
-        
     }
     
     @Test
     public void ec2UnmonitorInstancesTest() throws Exception {
-
-        Exchange exchange = template.request("direct:unmonitor", new Processor() {
+        
+        template.request("direct:unmonitor", new Processor() {
             
             @Override
             public void process(Exchange exchange) throws Exception {
-                Collection l = new ArrayList();
+                Collection<String> l = new ArrayList<>();
                 l.add("test-1");
-                exchange.getIn().setHeader(EC2Constants.INSTANCES_IDS, l);   
+                exchange.getIn().setHeader(EC2Constants.INSTANCES_IDS, l);
             }
         });
     }
-
+    
     @Override
     protected RouteBuilder createRouteBuilder() throws Exception {
         return new RouteBuilder() {
diff --git a/components/camel-aws/src/test/java/org/apache/camel/component/aws/firehose/KinesisFirehoseEndpointTest.java b/components/camel-aws/src/test/java/org/apache/camel/component/aws/firehose/KinesisFirehoseEndpointTest.java
index 2a0ef0f..67864b3 100644
--- a/components/camel-aws/src/test/java/org/apache/camel/component/aws/firehose/KinesisFirehoseEndpointTest.java
+++ b/components/camel-aws/src/test/java/org/apache/camel/component/aws/firehose/KinesisFirehoseEndpointTest.java
@@ -24,7 +24,7 @@ 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.junit.MockitoJUnitRunner;
 
 import static org.hamcrest.CoreMatchers.is;
 import static org.junit.Assert.assertThat;
diff --git a/components/camel-aws/src/test/java/org/apache/camel/component/aws/firehose/KinesisFirehoseProducerTest.java b/components/camel-aws/src/test/java/org/apache/camel/component/aws/firehose/KinesisFirehoseProducerTest.java
index 2096714..612e768 100644
--- a/components/camel-aws/src/test/java/org/apache/camel/component/aws/firehose/KinesisFirehoseProducerTest.java
+++ b/components/camel-aws/src/test/java/org/apache/camel/component/aws/firehose/KinesisFirehoseProducerTest.java
@@ -29,9 +29,9 @@ import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.mockito.Answers;
 import org.mockito.Mock;
-import org.mockito.runners.MockitoJUnitRunner;
+import org.mockito.junit.MockitoJUnitRunner;
 
-import static org.mockito.Matchers.any;
+import static org.mockito.ArgumentMatchers.any;
 import static org.mockito.Mockito.verify;
 import static org.mockito.Mockito.when;
 
@@ -57,10 +57,10 @@ public class KinesisFirehoseProducerTest {
     private Exchange exchange;
 
     private KinesisFirehoseProducer kinesisFirehoseProducer;
+
     @Before
     public void setup() throws Exception {
         when(kinesisFirehoseEndpoint.getClient()).thenReturn(kinesisFirehoseClient);
-        when(kinesisFirehoseEndpoint.getEndpointUri()).thenReturn("aws-kinesis-firehose://etl");
         when(kinesisFirehoseEndpoint.getStreamName()).thenReturn(STREAM_NAME);
         when(exchange.getOut()).thenReturn(outMessage);
         when(exchange.getIn()).thenReturn(inMessage);
diff --git a/components/camel-aws/src/test/java/org/apache/camel/component/aws/kinesis/KinesisConsumerTest.java b/components/camel-aws/src/test/java/org/apache/camel/component/aws/kinesis/KinesisConsumerTest.java
index 96de49b..3fb29fe 100644
--- a/components/camel-aws/src/test/java/org/apache/camel/component/aws/kinesis/KinesisConsumerTest.java
+++ b/components/camel-aws/src/test/java/org/apache/camel/component/aws/kinesis/KinesisConsumerTest.java
@@ -39,7 +39,7 @@ import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.mockito.ArgumentCaptor;
 import org.mockito.Mock;
-import org.mockito.runners.MockitoJUnitRunner;
+import org.mockito.junit.MockitoJUnitRunner;
 
 import static org.hamcrest.CoreMatchers.is;
 import static org.junit.Assert.assertThat;
@@ -138,7 +138,6 @@ public class KinesisConsumerTest {
 
     }
 
-
     @Test
     public void itUsesTheShardIteratorOnPolls() throws Exception {
         undertest.poll();
diff --git a/components/camel-aws/src/test/java/org/apache/camel/component/aws/kinesis/KinesisEndpointTest.java b/components/camel-aws/src/test/java/org/apache/camel/component/aws/kinesis/KinesisEndpointTest.java
index c156cca..3af34f5 100644
--- a/components/camel-aws/src/test/java/org/apache/camel/component/aws/kinesis/KinesisEndpointTest.java
+++ b/components/camel-aws/src/test/java/org/apache/camel/component/aws/kinesis/KinesisEndpointTest.java
@@ -25,7 +25,7 @@ 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.junit.MockitoJUnitRunner;
 
 import static org.hamcrest.CoreMatchers.is;
 import static org.junit.Assert.assertThat;
diff --git a/components/camel-aws/src/test/java/org/apache/camel/component/aws/kinesis/KinesisProducerTest.java b/components/camel-aws/src/test/java/org/apache/camel/component/aws/kinesis/KinesisProducerTest.java
index d0e3250..483bcc5 100644
--- a/components/camel-aws/src/test/java/org/apache/camel/component/aws/kinesis/KinesisProducerTest.java
+++ b/components/camel-aws/src/test/java/org/apache/camel/component/aws/kinesis/KinesisProducerTest.java
@@ -30,10 +30,10 @@ import org.junit.runner.RunWith;
 import org.mockito.Answers;
 import org.mockito.ArgumentCaptor;
 import org.mockito.Mock;
-import org.mockito.runners.MockitoJUnitRunner;
+import org.mockito.junit.MockitoJUnitRunner;
 
 import static org.junit.Assert.assertEquals;
-import static org.mockito.Matchers.any;
+import static org.mockito.ArgumentMatchers.any;
 import static org.mockito.Mockito.verify;
 import static org.mockito.Mockito.when;
 
@@ -63,7 +63,6 @@ public class KinesisProducerTest {
     @Before
     public void setup() throws Exception {
         when(kinesisEndpoint.getClient()).thenReturn(kinesisClient);
-        when(kinesisEndpoint.getEndpointUri()).thenReturn("kinesis://etl");
         when(kinesisEndpoint.getStreamName()).thenReturn(STREAM_NAME);
 
         when(exchange.getOut()).thenReturn(outMessage);
diff --git a/components/camel-aws/src/test/java/org/apache/camel/component/aws/lambda/LambdaComponentSpringTest.java b/components/camel-aws/src/test/java/org/apache/camel/component/aws/lambda/LambdaComponentSpringTest.java
index 84c8b56..400bd02 100644
--- a/components/camel-aws/src/test/java/org/apache/camel/component/aws/lambda/LambdaComponentSpringTest.java
+++ b/components/camel-aws/src/test/java/org/apache/camel/component/aws/lambda/LambdaComponentSpringTest.java
@@ -17,7 +17,6 @@
 package org.apache.camel.component.aws.lambda;
 
 import java.io.*;
-import com.amazonaws.services.lambda.AWSLambdaClient;
 import com.amazonaws.services.lambda.model.CreateFunctionResult;
 import com.amazonaws.services.lambda.model.DeleteFunctionResult;
 import com.amazonaws.services.lambda.model.GetFunctionResult;
@@ -27,23 +26,12 @@ import org.apache.camel.Exchange;
 import org.apache.camel.ExchangePattern;
 import org.apache.camel.Processor;
 import org.apache.camel.test.spring.CamelSpringTestSupport;
-import org.junit.Before;
 import org.junit.Test;
 import org.springframework.context.support.AbstractApplicationContext;
 import org.springframework.context.support.ClassPathXmlApplicationContext;
 
 public class LambdaComponentSpringTest extends CamelSpringTestSupport {
 
-    private AWSLambdaClient awsLambdaClient;
-
-    @Override
-    @Before
-    public void setUp() throws Exception {
-        super.setUp();
-
-        awsLambdaClient = context.getRegistry().lookupByNameAndType("awsLambdaClient", AmazonLambdaClientMock.class);
-    }
-
     @Test
     public void lambdaCreateFunctionTest() throws Exception {
 
diff --git a/components/camel-aws/src/test/java/org/apache/camel/component/aws/s3/AmazonS3EncryptionClientMock.java b/components/camel-aws/src/test/java/org/apache/camel/component/aws/s3/AmazonS3EncryptionClientMock.java
index afdf8ad..06e64fd 100644
--- a/components/camel-aws/src/test/java/org/apache/camel/component/aws/s3/AmazonS3EncryptionClientMock.java
+++ b/components/camel-aws/src/test/java/org/apache/camel/component/aws/s3/AmazonS3EncryptionClientMock.java
@@ -31,8 +31,6 @@ import com.amazonaws.AmazonClientException;
 import com.amazonaws.AmazonServiceException;
 import com.amazonaws.AmazonWebServiceRequest;
 import com.amazonaws.HttpMethod;
-import com.amazonaws.auth.BasicAWSCredentials;
-import com.amazonaws.services.s3.AmazonS3Client;
 import com.amazonaws.services.s3.AmazonS3EncryptionClient;
 import com.amazonaws.services.s3.S3ResponseMetadata;
 import com.amazonaws.services.s3.model.AbortMultipartUploadRequest;
diff --git a/components/camel-aws/src/test/java/org/apache/camel/component/aws/ses/MockMessage.java b/components/camel-aws/src/test/java/org/apache/camel/component/aws/ses/MockMessage.java
index 0d9cdef..af0c108 100644
--- a/components/camel-aws/src/test/java/org/apache/camel/component/aws/ses/MockMessage.java
+++ b/components/camel-aws/src/test/java/org/apache/camel/component/aws/ses/MockMessage.java
@@ -25,6 +25,7 @@ import java.util.Enumeration;
 import javax.activation.DataHandler;
 import javax.mail.Address;
 import javax.mail.Flags;
+import javax.mail.Header;
 import javax.mail.Message;
 import javax.mail.MessagingException;
 import javax.mail.Multipart;
@@ -133,18 +134,18 @@ public class MockMessage extends Message {
     }
 
     @Override
-    public Enumeration getAllHeaders() throws MessagingException {
+    public Enumeration<Header> getAllHeaders() throws MessagingException {
         return null;
     }
 
     @Override
-    public Enumeration getMatchingHeaders(String[] headernames)
+    public Enumeration<Header> getMatchingHeaders(String[] headernames)
         throws MessagingException {
         return null;
     }
 
     @Override
-    public Enumeration getNonMatchingHeaders(String[] headernames)
+    public Enumeration<Header> getNonMatchingHeaders(String[] headernames)
         throws MessagingException {
         return null;
     }
diff --git a/components/camel-aws/src/test/java/org/apache/camel/component/aws/sqs/AmazonSQSClientMock.java b/components/camel-aws/src/test/java/org/apache/camel/component/aws/sqs/AmazonSQSClientMock.java
index 451267b..5c8d71c 100644
--- a/components/camel-aws/src/test/java/org/apache/camel/component/aws/sqs/AmazonSQSClientMock.java
+++ b/components/camel-aws/src/test/java/org/apache/camel/component/aws/sqs/AmazonSQSClientMock.java
@@ -53,7 +53,7 @@ public class AmazonSQSClientMock extends AmazonSQSClient {
     Map<String, Map<String, String>> queueAttributes = new HashMap<String, Map<String, String>>();
     List<ChangeMessageVisibilityRequest> changeMessageVisibilityRequests = new CopyOnWriteArrayList<ChangeMessageVisibilityRequest>();
     private Map<String, CreateQueueRequest> queues = new LinkedHashMap<String, CreateQueueRequest>();
-    private Map<String, ScheduledFuture> inFlight = new LinkedHashMap<String, ScheduledFuture>();
+    private Map<String, ScheduledFuture<?>> inFlight = new LinkedHashMap<>();
     private ScheduledExecutorService scheduler;
 
     public AmazonSQSClientMock() {
@@ -122,7 +122,7 @@ public class AmazonSQSClientMock extends AmazonSQSClient {
         if (scheduler != null) {
             int visibility = getVisibilityForQueue(queueUrl);
             if (visibility > 0) {
-                ScheduledFuture task = scheduler.schedule(new Runnable() {
+                ScheduledFuture<?> task = scheduler.schedule(new Runnable() {
                     @Override
                     public void run() {
                         synchronized (messages) {
@@ -157,7 +157,7 @@ public class AmazonSQSClientMock extends AmazonSQSClient {
     public DeleteMessageResult deleteMessage(DeleteMessageRequest deleteMessageRequest) throws AmazonClientException {
         String receiptHandle = deleteMessageRequest.getReceiptHandle();
         if (inFlight.containsKey(receiptHandle)) {
-            ScheduledFuture inFlightTask = inFlight.get(receiptHandle);
+            ScheduledFuture<?> inFlightTask = inFlight.get(receiptHandle);
             inFlightTask.cancel(true);
         }
         return new DeleteMessageResult();
diff --git a/components/camel-aws/src/test/java/org/apache/camel/component/aws/sqs/SqsEndpointTest.java b/components/camel-aws/src/test/java/org/apache/camel/component/aws/sqs/SqsEndpointTest.java
index 3052e48..56a5fcb 100644
--- a/components/camel-aws/src/test/java/org/apache/camel/component/aws/sqs/SqsEndpointTest.java
+++ b/components/camel-aws/src/test/java/org/apache/camel/component/aws/sqs/SqsEndpointTest.java
@@ -48,12 +48,12 @@ public class SqsEndpointTest {
     public void doStartShouldNotCallUpdateQueueAttributesIfQueueExistAndNoOptionIsSpecified() throws Exception {
         Mockito.when(amazonSQSClient.listQueues())
             .thenReturn(new ListQueuesResult().withQueueUrls("https://sqs.us-east-1.amazonaws.com/ID/dummy-queue", "https://sqs.us-east-1.amazonaws.com/ID/test-queue"));
-        
+
         endpoint.doStart();
-        
+
         Mockito.verify(amazonSQSClient).listQueues();
     }
-    
+
     @Test
     public void doStartWithDifferentQueueOwner() throws Exception {
 
diff --git a/components/camel-aws/src/test/java/org/apache/camel/component/aws/sqs/SqsProducerTest.java b/components/camel-aws/src/test/java/org/apache/camel/component/aws/sqs/SqsProducerTest.java
index e1e511d..8dc5a03 100644
--- a/components/camel-aws/src/test/java/org/apache/camel/component/aws/sqs/SqsProducerTest.java
+++ b/components/camel-aws/src/test/java/org/apache/camel/component/aws/sqs/SqsProducerTest.java
@@ -23,6 +23,7 @@ import java.util.Map;
 import com.amazonaws.services.sqs.AmazonSQSClient;
 import com.amazonaws.services.sqs.model.SendMessageRequest;
 import com.amazonaws.services.sqs.model.SendMessageResult;
+
 import org.apache.camel.Exchange;
 import org.apache.camel.ExchangePattern;
 import org.apache.camel.Message;
@@ -32,12 +33,11 @@ import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.mockito.ArgumentCaptor;
 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.assertNull;
-import static org.mockito.Matchers.any;
-import static org.mockito.Mockito.RETURNS_DEEP_STUBS;
-import static org.mockito.Mockito.mock;
+import static org.mockito.ArgumentMatchers.any;
 import static org.mockito.Mockito.verify;
 import static org.mockito.Mockito.when;
 
@@ -57,16 +57,19 @@ public class SqsProducerTest {
     private static final String SAMPLE_MESSAGE_HEADER_VALUE_4 = "testValue";
     private static final String SAMPLE_EXCHANGE_ID = "ID:whatever-the-hostname-is-32818-1506943497897-1:1:8:1:75939";
     
-    Exchange exchange = mock(Exchange.class, RETURNS_DEEP_STUBS);
-
-    @Mock private SqsEndpoint sqsEndpoint;
-    @Mock private AmazonSQSClient amazonSQSClient;
-    @Mock private Message outMessage;
-    @Mock private Message inMessage;
+    @Mock
+    Exchange exchange;
+    @Mock
+    private SqsEndpoint sqsEndpoint;
+    @Mock
+    private AmazonSQSClient amazonSQSClient;
+    @Mock
+    private Message outMessage;
+    @Mock
+    private Message inMessage;
     
     private SendMessageResult sendMessageResult;
     private SqsConfiguration sqsConfiguration;
-
     private SqsProducer underTest;
 
     @Before
@@ -80,7 +83,6 @@ public class SqsProducerTest {
         when(sqsEndpoint.getClient()).thenReturn(amazonSQSClient);
         when(sqsEndpoint.getConfiguration()).thenReturn(sqsConfiguration);
         when(amazonSQSClient.sendMessage(any(SendMessageRequest.class))).thenReturn(sendMessageResult);
-        when(exchange.getOut()).thenReturn(outMessage);
         when(exchange.getIn()).thenReturn(inMessage);
         when(exchange.getPattern()).thenReturn(ExchangePattern.InOnly);
         when(exchange.getExchangeId()).thenReturn(SAMPLE_EXCHANGE_ID);
@@ -88,30 +90,30 @@ public class SqsProducerTest {
         when(sqsEndpoint.getQueueUrl()).thenReturn(QUEUE_URL);
         when(sqsEndpoint.getHeaderFilterStrategy()).thenReturn(headerFilterStrategy);
     }
-
+    
     @Test
     public void itSendsTheBodyFromAnExchange() throws Exception {
         underTest.process(exchange);
-
+        
         ArgumentCaptor<SendMessageRequest> capture = ArgumentCaptor.forClass(SendMessageRequest.class);
         verify(amazonSQSClient).sendMessage(capture.capture());
         assertEquals(SAMPLE_MESSAGE_BODY, capture.getValue().getMessageBody());
     }
-
+    
     @Test
     public void itSendsTheCorrectQueueUrl() throws Exception {
         underTest.process(exchange);
-
+        
         ArgumentCaptor<SendMessageRequest> capture = ArgumentCaptor.forClass(SendMessageRequest.class);
         verify(amazonSQSClient).sendMessage(capture.capture());
         assertEquals(QUEUE_URL, capture.getValue().getQueueUrl());
     }
-
+    
     @Test
     public void itSetsTheDelayFromTheConfigurationOnTheRequest() throws Exception {
         sqsConfiguration.setDelaySeconds(Integer.valueOf(9001));
         underTest.process(exchange);
-
+        
         ArgumentCaptor<SendMessageRequest> capture = ArgumentCaptor.forClass(SendMessageRequest.class);
         verify(amazonSQSClient).sendMessage(capture.capture());
         assertEquals(9001, capture.getValue().getDelaySeconds().intValue());
@@ -121,18 +123,18 @@ public class SqsProducerTest {
     public void itSetsTheDelayFromMessageHeaderOnTheRequest() throws Exception {
         when(inMessage.getHeader(SqsConstants.DELAY_HEADER, Integer.class)).thenReturn(Integer.valueOf(2000));
         underTest.process(exchange);
-
+        
         ArgumentCaptor<SendMessageRequest> capture = ArgumentCaptor.forClass(SendMessageRequest.class);
         verify(amazonSQSClient).sendMessage(capture.capture());
         assertEquals(2000, capture.getValue().getDelaySeconds().intValue());
     }
-
+    
     @Test
     public void itSetsTheMessageIdOnTheExchangeMessage() throws Exception {
         underTest.process(exchange);
         verify(inMessage).setHeader(SqsConstants.MESSAGE_ID, MESSAGE_ID);
     }
-
+    
     @Test
     public void itSetsTheMd5SumOnTheExchangeMessage() throws Exception {
         underTest.process(exchange);
@@ -145,15 +147,12 @@ public class SqsProducerTest {
         headers.put(SAMPLE_MESSAGE_HEADER_NAME_1, SAMPLE_MESSAGE_HEADER_VALUE_1);
         when(inMessage.getHeaders()).thenReturn(headers);
         underTest.process(exchange);
-
+        
         ArgumentCaptor<SendMessageRequest> capture = ArgumentCaptor.forClass(SendMessageRequest.class);
         verify(amazonSQSClient).sendMessage(capture.capture());
-
-        assertEquals(SAMPLE_MESSAGE_HEADER_VALUE_1,
-                     capture.getValue().getMessageAttributes().get(SAMPLE_MESSAGE_HEADER_NAME_1)
-                         .getStringValue());
-        assertNull(capture.getValue().getMessageAttributes().get(SAMPLE_MESSAGE_HEADER_NAME_1)
-            .getBinaryValue());
+        
+        assertEquals(SAMPLE_MESSAGE_HEADER_VALUE_1, capture.getValue().getMessageAttributes().get(SAMPLE_MESSAGE_HEADER_NAME_1).getStringValue());
+        assertNull(capture.getValue().getMessageAttributes().get(SAMPLE_MESSAGE_HEADER_NAME_1).getBinaryValue());
     }
     
     @Test
@@ -162,17 +161,14 @@ public class SqsProducerTest {
         headers.put(SAMPLE_MESSAGE_HEADER_NAME_2, SAMPLE_MESSAGE_HEADER_VALUE_2);
         when(inMessage.getHeaders()).thenReturn(headers);
         underTest.process(exchange);
-
+        
         ArgumentCaptor<SendMessageRequest> capture = ArgumentCaptor.forClass(SendMessageRequest.class);
         verify(amazonSQSClient).sendMessage(capture.capture());
-
-        assertEquals(SAMPLE_MESSAGE_HEADER_VALUE_2,
-                     capture.getValue().getMessageAttributes().get(SAMPLE_MESSAGE_HEADER_NAME_2)
-                         .getBinaryValue());
-        assertNull(capture.getValue().getMessageAttributes().get(SAMPLE_MESSAGE_HEADER_NAME_2)
-            .getStringValue());
+        
+        assertEquals(SAMPLE_MESSAGE_HEADER_VALUE_2, capture.getValue().getMessageAttributes().get(SAMPLE_MESSAGE_HEADER_NAME_2).getBinaryValue());
+        assertNull(capture.getValue().getMessageAttributes().get(SAMPLE_MESSAGE_HEADER_NAME_2).getStringValue());
     }
-
+    
     @Test
     public void isAllAttributeMessagesOnTheRequest() throws Exception {
         Map<String, Object> headers = new HashMap<String, Object>();
@@ -182,48 +178,40 @@ public class SqsProducerTest {
         headers.put(SAMPLE_MESSAGE_HEADER_NAME_4, SAMPLE_MESSAGE_HEADER_VALUE_4);
         when(inMessage.getHeaders()).thenReturn(headers);
         underTest.process(exchange);
-
+        
         ArgumentCaptor<SendMessageRequest> capture = ArgumentCaptor.forClass(SendMessageRequest.class);
         verify(amazonSQSClient).sendMessage(capture.capture());
-
-        assertEquals(SAMPLE_MESSAGE_HEADER_VALUE_1,
-                     capture.getValue().getMessageAttributes().get(SAMPLE_MESSAGE_HEADER_NAME_1)
-                         .getStringValue());
-        assertEquals(SAMPLE_MESSAGE_HEADER_VALUE_2,
-                     capture.getValue().getMessageAttributes().get(SAMPLE_MESSAGE_HEADER_NAME_2)
-                         .getBinaryValue());
-        assertEquals(SAMPLE_MESSAGE_HEADER_VALUE_3,
-                     capture.getValue().getMessageAttributes().get(SAMPLE_MESSAGE_HEADER_NAME_3)
-                         .getStringValue());
+        
+        assertEquals(SAMPLE_MESSAGE_HEADER_VALUE_1, capture.getValue().getMessageAttributes().get(SAMPLE_MESSAGE_HEADER_NAME_1).getStringValue());
+        assertEquals(SAMPLE_MESSAGE_HEADER_VALUE_2, capture.getValue().getMessageAttributes().get(SAMPLE_MESSAGE_HEADER_NAME_2).getBinaryValue());
+        assertEquals(SAMPLE_MESSAGE_HEADER_VALUE_3, capture.getValue().getMessageAttributes().get(SAMPLE_MESSAGE_HEADER_NAME_3).getStringValue());
         assertEquals(3, capture.getValue().getMessageAttributes().size());
     }
-
+    
     @Test
     public void itSetsMessageGroupIdUsingConstantStrategy() throws Exception {
         sqsConfiguration.setQueueName("queueName.fifo");
         sqsConfiguration.setMessageGroupIdStrategy("useConstant");
-
+        
         underTest.process(exchange);
-
+        
         ArgumentCaptor<SendMessageRequest> capture = ArgumentCaptor.forClass(SendMessageRequest.class);
         verify(amazonSQSClient).sendMessage(capture.capture());
-
-        assertEquals("CamelSingleMessageGroup", capture.getValue().getMessageGroupId());
         
+        assertEquals("CamelSingleMessageGroup", capture.getValue().getMessageGroupId());
     }
     
     @Test
     public void itSetsMessageGroupIdUsingExchangeIdStrategy() throws Exception {
         sqsConfiguration.setQueueName("queueName.fifo");
         sqsConfiguration.setMessageGroupIdStrategy("useExchangeId");
-
+        
         underTest.process(exchange);
-
+        
         ArgumentCaptor<SendMessageRequest> capture = ArgumentCaptor.forClass(SendMessageRequest.class);
         verify(amazonSQSClient).sendMessage(capture.capture());
-
-        assertEquals(SAMPLE_EXCHANGE_ID, capture.getValue().getMessageGroupId());
         
+        assertEquals(SAMPLE_EXCHANGE_ID, capture.getValue().getMessageGroupId());
     }
     
     @Test
@@ -231,58 +219,53 @@ public class SqsProducerTest {
         sqsConfiguration.setQueueName("queueName.fifo");
         sqsConfiguration.setMessageGroupIdStrategy("usePropertyValue");
         when(exchange.getProperty(SqsConstants.MESSAGE_GROUP_ID_PROPERTY, String.class)).thenReturn("my-group-id");
-
+        
         underTest.process(exchange);
-
+        
         ArgumentCaptor<SendMessageRequest> capture = ArgumentCaptor.forClass(SendMessageRequest.class);
         verify(amazonSQSClient).sendMessage(capture.capture());
-
-        assertEquals("my-group-id", capture.getValue().getMessageGroupId());
         
+        assertEquals("my-group-id", capture.getValue().getMessageGroupId());
     }
-
+    
     @Test
     public void itSetsMessageDedpulicationIdUsingExchangeIdStrategy() throws Exception {
         sqsConfiguration.setQueueName("queueName.fifo");
         sqsConfiguration.setMessageGroupIdStrategy("useConstant");
         sqsConfiguration.setMessageDeduplicationIdStrategy("useExchangeId");
-
+        
         underTest.process(exchange);
-
+        
         ArgumentCaptor<SendMessageRequest> capture = ArgumentCaptor.forClass(SendMessageRequest.class);
         verify(amazonSQSClient).sendMessage(capture.capture());
-
-        assertEquals(SAMPLE_EXCHANGE_ID, capture.getValue().getMessageDeduplicationId());
         
+        assertEquals(SAMPLE_EXCHANGE_ID, capture.getValue().getMessageDeduplicationId());
     }
-
+    
     @Test
     public void itSetsMessageDedpulicationIdUsingExchangeIdStrategyAsDefault() throws Exception {
         sqsConfiguration.setQueueName("queueName.fifo");
         sqsConfiguration.setMessageGroupIdStrategy("useConstant");
-
+        
         underTest.process(exchange);
-
+        
         ArgumentCaptor<SendMessageRequest> capture = ArgumentCaptor.forClass(SendMessageRequest.class);
         verify(amazonSQSClient).sendMessage(capture.capture());
-
-        assertEquals(SAMPLE_EXCHANGE_ID, capture.getValue().getMessageDeduplicationId());
         
+        assertEquals(SAMPLE_EXCHANGE_ID, capture.getValue().getMessageDeduplicationId());
     }
-
+    
     @Test
     public void itDoesNotSetMessageDedpulicationIdUsingContentBasedDeduplicationStrategy() throws Exception {
         sqsConfiguration.setQueueName("queueName.fifo");
         sqsConfiguration.setMessageGroupIdStrategy("useConstant");
         sqsConfiguration.setMessageDeduplicationIdStrategy("useContentBasedDeduplication");
-
+        
         underTest.process(exchange);
-
+        
         ArgumentCaptor<SendMessageRequest> capture = ArgumentCaptor.forClass(SendMessageRequest.class);
         verify(amazonSQSClient).sendMessage(capture.capture());
-
-        assertNull(capture.getValue().getMessageDeduplicationId());
         
+        assertNull(capture.getValue().getMessageDeduplicationId());
     }
-
-}
\ No newline at end of file
+}
diff --git a/components/camel-aws/src/test/java/org/apache/camel/component/aws/swf/CamelSWFActivityClientTest.java b/components/camel-aws/src/test/java/org/apache/camel/component/aws/swf/CamelSWFActivityClientTest.java
index c7883cc..73764eb 100644
--- a/components/camel-aws/src/test/java/org/apache/camel/component/aws/swf/CamelSWFActivityClientTest.java
+++ b/components/camel-aws/src/test/java/org/apache/camel/component/aws/swf/CamelSWFActivityClientTest.java
@@ -16,36 +16,39 @@
  */
 package org.apache.camel.component.aws.swf;
 
-import com.amazonaws.services.simpleworkflow.flow.ActivitySchedulingOptions;
 import com.amazonaws.services.simpleworkflow.flow.DynamicActivitiesClient;
 import com.amazonaws.services.simpleworkflow.flow.core.Promise;
 import com.amazonaws.services.simpleworkflow.model.ActivityType;
+
 import org.junit.Before;
 import org.junit.Test;
-import static org.mockito.Matchers.any;
-import static org.mockito.Matchers.isNull;
+import org.mockito.ArgumentMatchers;
+
+
+import static org.mockito.ArgumentMatchers.any;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.verify;
 
 public class CamelSWFActivityClientTest {
 
-    private DynamicActivitiesClient activitiesClient;
+    private DynamicActivitiesClient actClient;
     private CamelSWFActivityClient camelSWFActivityClient;
 
     @Before
     public void setUp() throws Exception {
-        activitiesClient = mock(DynamicActivitiesClient.class);
+        actClient = mock(DynamicActivitiesClient.class);
         camelSWFActivityClient = new CamelSWFActivityClient(new SWFConfiguration()) {
             @Override
             DynamicActivitiesClient getDynamicActivitiesClient() {
-                return activitiesClient;
+                return actClient;
             }
         };
     }
 
     @Test
     public void testScheduleActivity() throws Exception {
-        Object result = camelSWFActivityClient.scheduleActivity("eventName", "version", "input");
-        verify(activitiesClient).scheduleActivity(any(ActivityType.class),  any(Promise[].class), isNull(ActivitySchedulingOptions.class), any(Class.class), isNull(Promise.class));
+        camelSWFActivityClient.scheduleActivity("eventName", "version", "input");
+
+        verify(actClient).scheduleActivity(any(ActivityType.class), ArgumentMatchers.<Promise<?>[]> any(), ArgumentMatchers.isNull(), ArgumentMatchers.<Class<?>> any(), ArgumentMatchers.isNull());
     }
 }
diff --git a/components/camel-aws/src/test/java/org/apache/camel/component/aws/swf/CamelSWFActivityConsumerTest.java b/components/camel-aws/src/test/java/org/apache/camel/component/aws/swf/CamelSWFActivityConsumerTest.java
index 33e8a47..9aaebf1 100644
--- a/components/camel-aws/src/test/java/org/apache/camel/component/aws/swf/CamelSWFActivityConsumerTest.java
+++ b/components/camel-aws/src/test/java/org/apache/camel/component/aws/swf/CamelSWFActivityConsumerTest.java
@@ -22,7 +22,7 @@ import org.apache.camel.Exchange;
 import org.apache.camel.Predicate;
 import org.apache.camel.builder.RouteBuilder;
 import org.junit.Test;
-import static org.mockito.Matchers.any;
+import static org.mockito.ArgumentMatchers.any;
 import static org.mockito.Mockito.atLeastOnce;
 import static org.mockito.Mockito.verify;
 import static org.mockito.Mockito.when;
diff --git a/components/camel-aws/src/test/java/org/apache/camel/component/aws/swf/CamelSWFWorkflowClientTest.java b/components/camel-aws/src/test/java/org/apache/camel/component/aws/swf/CamelSWFWorkflowClientTest.java
index 7796847..e775942 100644
--- a/components/camel-aws/src/test/java/org/apache/camel/component/aws/swf/CamelSWFWorkflowClientTest.java
+++ b/components/camel-aws/src/test/java/org/apache/camel/component/aws/swf/CamelSWFWorkflowClientTest.java
@@ -32,7 +32,7 @@ import org.junit.Before;
 import org.junit.Test;
 import static org.hamcrest.CoreMatchers.is;
 import static org.hamcrest.MatcherAssert.assertThat;
-import static org.mockito.Matchers.any;
+import static org.mockito.ArgumentMatchers.any;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.verify;
 import static org.mockito.Mockito.when;
@@ -72,7 +72,7 @@ public class CamelSWFWorkflowClientTest {
         Date closeTimestamp = new Date();
         executionInfo.setCloseTimestamp(closeTimestamp);
         executionInfo.setExecutionStatus("CLOSED");
-        executionInfo.setTagList(Collections.EMPTY_LIST);
+        executionInfo.setTagList(Collections.emptyList());
 
         WorkflowExecutionDetail workflowExecutionDetail = new WorkflowExecutionDetail();
         workflowExecutionDetail.setExecutionInfo(executionInfo);
@@ -89,7 +89,7 @@ public class CamelSWFWorkflowClientTest {
         assertThat((String) description.get("closeStatus"), is("COMPLETED"));
         assertThat((Date) description.get("closeTimestamp"), is(closeTimestamp));
         assertThat((String) description.get("executionStatus"), is("CLOSED"));
-        assertThat((List) description.get("tagList"), is(Collections.EMPTY_LIST));
+        assertThat((List<?>) description.get("tagList"), is(Collections.EMPTY_LIST));
         assertThat((WorkflowExecutionDetail) description.get("executionDetail"), is(workflowExecutionDetail));
     }
 
diff --git a/components/camel-aws/src/test/java/org/apache/camel/component/aws/swf/CamelSWFWorkflowConsumerTest.java b/components/camel-aws/src/test/java/org/apache/camel/component/aws/swf/CamelSWFWorkflowConsumerTest.java
index 01f2197..85de424 100644
--- a/components/camel-aws/src/test/java/org/apache/camel/component/aws/swf/CamelSWFWorkflowConsumerTest.java
+++ b/components/camel-aws/src/test/java/org/apache/camel/component/aws/swf/CamelSWFWorkflowConsumerTest.java
@@ -22,7 +22,7 @@ import org.apache.camel.Exchange;
 import org.apache.camel.Predicate;
 import org.apache.camel.builder.RouteBuilder;
 import org.junit.Test;
-import static org.mockito.Matchers.any;
+import static org.mockito.ArgumentMatchers.any;
 import static org.mockito.Mockito.atLeastOnce;
 import static org.mockito.Mockito.verify;
 import static org.mockito.Mockito.when;
diff --git a/components/camel-aws/src/test/java/org/apache/camel/component/aws/swf/CamelSWFWorkflowProducerTest.java b/components/camel-aws/src/test/java/org/apache/camel/component/aws/swf/CamelSWFWorkflowProducerTest.java
index f394792..6d28198 100644
--- a/components/camel-aws/src/test/java/org/apache/camel/component/aws/swf/CamelSWFWorkflowProducerTest.java
+++ b/components/camel-aws/src/test/java/org/apache/camel/component/aws/swf/CamelSWFWorkflowProducerTest.java
@@ -22,7 +22,7 @@ import org.apache.camel.Exchange;
 import org.apache.camel.Processor;
 import org.apache.camel.builder.RouteBuilder;
 import org.junit.Test;
-import static org.mockito.Matchers.any;
+import static org.mockito.ArgumentMatchers.any;
 import static org.mockito.Mockito.when;
 
 public class CamelSWFWorkflowProducerTest extends CamelSWFTestSupport {
diff --git a/components/camel-printer/pom.xml b/components/camel-printer/pom.xml
index a10bfdd..22def12 100644
--- a/components/camel-printer/pom.xml
+++ b/components/camel-printer/pom.xml
@@ -56,10 +56,10 @@
         </dependency>
         <dependency>
             <groupId>org.mockito</groupId>
-            <artifactId>mockito-all</artifactId>
-            <version>${mockito-version}</version>
+            <artifactId>mockito-core</artifactId>
+            <version>${mockito2-version}</version>
             <scope>test</scope>
-        </dependency>   
+        </dependency>
         <dependency>
             <groupId>org.apache.logging.log4j</groupId>
             <artifactId>log4j-api</artifactId>
diff --git a/components/camel-printer/src/test/java/org/apache/camel/component/printer/PrinterPrintTest.java b/components/camel-printer/src/test/java/org/apache/camel/component/printer/PrinterPrintTest.java
index 12f9de3..8c099c4 100644
--- a/components/camel-printer/src/test/java/org/apache/camel/component/printer/PrinterPrintTest.java
+++ b/components/camel-printer/src/test/java/org/apache/camel/component/printer/PrinterPrintTest.java
@@ -44,7 +44,7 @@ import org.junit.Before;
 import org.junit.Ignore;
 import org.junit.Test;
 
-import static org.mockito.Matchers.any;
+import static org.mockito.ArgumentMatchers.any;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.times;
 import static org.mockito.Mockito.verify;
diff --git a/components/camel-rabbitmq/pom.xml b/components/camel-rabbitmq/pom.xml
index ef78c12..b8877eb 100644
--- a/components/camel-rabbitmq/pom.xml
+++ b/components/camel-rabbitmq/pom.xml
@@ -63,8 +63,9 @@
     <dependency>
       <groupId>org.mockito</groupId>
       <artifactId>mockito-core</artifactId>
+      <version>${mockito2-version}</version>
       <scope>test</scope>
-    </dependency>   
+    </dependency>
     <dependency>
       <groupId>org.apache.logging.log4j</groupId>
       <artifactId>log4j-api</artifactId>
diff --git a/components/camel-rabbitmq/src/test/java/org/apache/camel/component/rabbitmq/RabbitMQConsumerTest.java b/components/camel-rabbitmq/src/test/java/org/apache/camel/component/rabbitmq/RabbitMQConsumerTest.java
index da84477..00c6d1e 100644
--- a/components/camel-rabbitmq/src/test/java/org/apache/camel/component/rabbitmq/RabbitMQConsumerTest.java
+++ b/components/camel-rabbitmq/src/test/java/org/apache/camel/component/rabbitmq/RabbitMQConsumerTest.java
@@ -27,14 +27,13 @@ import com.rabbitmq.client.Connection;
 import com.rabbitmq.client.Consumer;
 import org.apache.camel.Processor;
 import org.junit.Test;
-import org.mockito.Matchers;
 import org.mockito.Mockito;
 
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
-import static org.mockito.Matchers.any;
-import static org.mockito.Matchers.anyBoolean;
-import static org.mockito.Matchers.anyString;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.anyBoolean;
+import static org.mockito.ArgumentMatchers.anyString;
 
 public class RabbitMQConsumerTest {
 
@@ -50,7 +49,7 @@ public class RabbitMQConsumerTest {
         ThreadPoolExecutor e = (ThreadPoolExecutor) Executors.newFixedThreadPool(3);
         Mockito.when(endpoint.createExecutor()).thenReturn(e);
         Mockito.when(endpoint.getConcurrentConsumers()).thenReturn(1);
-        Mockito.when(endpoint.connect(Matchers.any(ExecutorService.class))).thenReturn(conn);
+        Mockito.when(endpoint.connect(any(ExecutorService.class))).thenReturn(conn);
         Mockito.when(conn.createChannel()).thenReturn(channel);
 
         consumer.doStart();
@@ -66,7 +65,7 @@ public class RabbitMQConsumerTest {
 
         Mockito.when(endpoint.createExecutor()).thenReturn(Executors.newFixedThreadPool(3));
         Mockito.when(endpoint.getConcurrentConsumers()).thenReturn(1);
-        Mockito.when(endpoint.connect(Matchers.any(ExecutorService.class))).thenReturn(conn);
+        Mockito.when(endpoint.connect(any(ExecutorService.class))).thenReturn(conn);
         Mockito.when(conn.createChannel()).thenReturn(channel);
 
         consumer.doStart();
@@ -83,7 +82,7 @@ public class RabbitMQConsumerTest {
 
         Mockito.when(endpoint.createExecutor()).thenReturn(Executors.newFixedThreadPool(3));
         Mockito.when(endpoint.getConcurrentConsumers()).thenReturn(1);
-        Mockito.when(endpoint.connect(Matchers.any(ExecutorService.class))).thenReturn(conn);
+        Mockito.when(endpoint.connect(any(ExecutorService.class))).thenReturn(conn);
         Mockito.when(conn.createChannel()).thenReturn(channel);
         Mockito.when(channel.basicConsume(anyString(), anyBoolean(), any(Consumer.class))).thenReturn("TAG");
         Mockito.when(channel.isOpen()).thenReturn(false);
diff --git a/components/camel-rabbitmq/src/test/java/org/apache/camel/component/rabbitmq/RabbitMQInOutIntTest.java b/components/camel-rabbitmq/src/test/java/org/apache/camel/component/rabbitmq/RabbitMQInOutIntTest.java
index 4a956ef..467c57e 100644
--- a/components/camel-rabbitmq/src/test/java/org/apache/camel/component/rabbitmq/RabbitMQInOutIntTest.java
+++ b/components/camel-rabbitmq/src/test/java/org/apache/camel/component/rabbitmq/RabbitMQInOutIntTest.java
@@ -190,7 +190,7 @@ public class RabbitMQInOutIntTest extends CamelTestSupport {
         foo.setName("foobar");
 
         try {
-            TestPartiallySerializableObject reply = template.requestBodyAndHeader("direct:rabbitMQ", foo, RabbitMQConstants.EXCHANGE_NAME, EXCHANGE, TestPartiallySerializableObject.class);
+            template.requestBodyAndHeader("direct:rabbitMQ", foo, RabbitMQConstants.EXCHANGE_NAME, EXCHANGE, TestPartiallySerializableObject.class);
         } catch (CamelExecutionException e) {
             // expected
         }
@@ -256,7 +256,7 @@ public class RabbitMQInOutIntTest extends CamelTestSupport {
         resultEndpoint.expectedMessageCount(1);
 
         try {
-            String reply = template.requestBodyAndHeaders("direct:rabbitMQNoAutoAck", "testMessage", headers, String.class);
+            template.requestBodyAndHeaders("direct:rabbitMQNoAutoAck", "testMessage", headers, String.class);
             fail("This should have thrown an exception");
         } catch (CamelExecutionException e) {
             if (!(e.getCause() instanceof IllegalStateException)) {
diff --git a/components/camel-rabbitmq/src/test/java/org/apache/camel/component/rabbitmq/RabbitMQLoadIntTest.java b/components/camel-rabbitmq/src/test/java/org/apache/camel/component/rabbitmq/RabbitMQLoadIntTest.java
index 4e4e52b..281ef52 100644
--- a/components/camel-rabbitmq/src/test/java/org/apache/camel/component/rabbitmq/RabbitMQLoadIntTest.java
+++ b/components/camel-rabbitmq/src/test/java/org/apache/camel/component/rabbitmq/RabbitMQLoadIntTest.java
@@ -79,7 +79,7 @@ public class RabbitMQLoadIntTest extends CamelTestSupport {
     public void testSendEndReceive() throws Exception {
         // Start producers
         ExecutorService executorService = Executors.newFixedThreadPool(PRODUCER_COUNT);
-        List<Future> futures = new ArrayList<Future>(PRODUCER_COUNT);
+        List<Future<?>> futures = new ArrayList<>(PRODUCER_COUNT);
         for (int i = 0; i < PRODUCER_COUNT; i++) {
             futures.add(executorService.submit(new Runnable() {
                 @Override
@@ -92,7 +92,7 @@ public class RabbitMQLoadIntTest extends CamelTestSupport {
             }));
         }
         // Wait for producers to end
-        for (Future future : futures) {
+        for (Future<?> future : futures) {
             future.get(5, TimeUnit.SECONDS);
         }
         // Check message count
diff --git a/components/camel-rabbitmq/src/test/java/org/apache/camel/component/rabbitmq/RabbitMQProducerIntTest.java b/components/camel-rabbitmq/src/test/java/org/apache/camel/component/rabbitmq/RabbitMQProducerIntTest.java
index a4f3550..77bb1c1 100644
--- a/components/camel-rabbitmq/src/test/java/org/apache/camel/component/rabbitmq/RabbitMQProducerIntTest.java
+++ b/components/camel-rabbitmq/src/test/java/org/apache/camel/component/rabbitmq/RabbitMQProducerIntTest.java
@@ -24,14 +24,12 @@ import java.util.concurrent.TimeoutException;
 import com.rabbitmq.client.AMQP;
 import com.rabbitmq.client.Channel;
 import com.rabbitmq.client.Connection;
-import com.rabbitmq.client.ConnectionFactory;
 import com.rabbitmq.client.DefaultConsumer;
 import com.rabbitmq.client.Envelope;
 import org.apache.camel.Produce;
 import org.apache.camel.ProducerTemplate;
 import org.apache.camel.RuntimeCamelException;
 import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.test.junit4.CamelTestSupport;
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
diff --git a/components/camel-rabbitmq/src/test/java/org/apache/camel/component/rabbitmq/RabbitMQProducerTest.java b/components/camel-rabbitmq/src/test/java/org/apache/camel/component/rabbitmq/RabbitMQProducerTest.java
index 602e4b7..d3db3dd 100644
--- a/components/camel-rabbitmq/src/test/java/org/apache/camel/component/rabbitmq/RabbitMQProducerTest.java
+++ b/components/camel-rabbitmq/src/test/java/org/apache/camel/component/rabbitmq/RabbitMQProducerTest.java
@@ -34,12 +34,12 @@ import org.apache.camel.impl.DefaultCamelContext;
 import org.apache.camel.impl.DefaultMessage;
 import org.junit.Before;
 import org.junit.Test;
-import org.mockito.Matchers;
 import org.mockito.Mockito;
 
 import static org.junit.Assert.assertArrayEquals;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNull;
+import static org.mockito.ArgumentMatchers.any;
 
 public class RabbitMQProducerTest {
 
@@ -51,7 +51,7 @@ public class RabbitMQProducerTest {
     @Before
     public void before() throws IOException, TimeoutException {
         Mockito.when(exchange.getIn()).thenReturn(message);
-        Mockito.when(endpoint.connect(Matchers.any(ExecutorService.class))).thenReturn(conn);
+        Mockito.when(endpoint.connect(any(ExecutorService.class))).thenReturn(conn);
         Mockito.when(conn.createChannel()).thenReturn(null);
         Mockito.when(endpoint.getMessageConverter()).thenReturn(new RabbitMQMessageConverter());
     }
diff --git a/components/camel-reactive-streams/pom.xml b/components/camel-reactive-streams/pom.xml
index 5964ea0..0c9ae71 100644
--- a/components/camel-reactive-streams/pom.xml
+++ b/components/camel-reactive-streams/pom.xml
@@ -94,12 +94,6 @@
             <artifactId>junit</artifactId>
             <scope>test</scope>
         </dependency>
-        <dependency>
-            <groupId>org.mockito</groupId>
-            <artifactId>mockito-all</artifactId>
-            <version>${mockito-version}</version>
-            <scope>test</scope>
-        </dependency>
     </dependencies>
 
 </project>
\ No newline at end of file
diff --git a/components/camel-reactive-streams/src/test/java/org/apache/camel/component/reactive/streams/BasicSubscriberTest.java b/components/camel-reactive-streams/src/test/java/org/apache/camel/component/reactive/streams/BasicSubscriberTest.java
index 567cd3c..ef15a80 100644
--- a/components/camel-reactive-streams/src/test/java/org/apache/camel/component/reactive/streams/BasicSubscriberTest.java
+++ b/components/camel-reactive-streams/src/test/java/org/apache/camel/component/reactive/streams/BasicSubscriberTest.java
@@ -53,7 +53,6 @@ public class BasicSubscriberTest extends CamelTestSupport {
     }
 
     @Override
-    @SuppressWarnings("unchecked")
     protected void doPostSetup() throws Exception {
 
         Subscriber<Integer> sub = CamelReactiveStreams.get(context()).streamSubscriber("sub", Integer.class);

-- 
To stop receiving notification emails like this one, please contact
['"commits@camel.apache.org" <commits@camel.apache.org>'].

Mime
View raw message