diff --git a/CHANGES_NEXT_RELEASE b/CHANGES_NEXT_RELEASE index 6fec658b3..8aa2d253a 100644 --- a/CHANGES_NEXT_RELEASE +++ b/CHANGES_NEXT_RELEASE @@ -1,3 +1,4 @@ +- [cygnus-ngsi][cygnus-common] upgrade mockito dep from 1.9.5 to 5.5.0 - [cygnus-ngsi] Fix runtime error: check access aggregator size (#2293) - [cygnus-ngsi] Switch log level to CYGNUS_LOG_LEVEL env var if was provided to docker (#2286) - [cygnus-common][SQL] Fix expiration records tablename used by delete and select (#2265) diff --git a/cygnus-common/pom.xml b/cygnus-common/pom.xml index a6c0bf3e3..b0598b381 100644 --- a/cygnus-common/pom.xml +++ b/cygnus-common/pom.xml @@ -26,8 +26,8 @@ org.mockito - mockito-all - 1.9.5 + mockito-core + 5.5.0 test diff --git a/cygnus-common/src/test/java/com/telefonica/iot/cygnus/backends/ckan/CKANBackendImplTest.java b/cygnus-common/src/test/java/com/telefonica/iot/cygnus/backends/ckan/CKANBackendImplTest.java index ccc24750e..6b74a7b57 100644 --- a/cygnus-common/src/test/java/com/telefonica/iot/cygnus/backends/ckan/CKANBackendImplTest.java +++ b/cygnus-common/src/test/java/com/telefonica/iot/cygnus/backends/ckan/CKANBackendImplTest.java @@ -32,7 +32,7 @@ import org.junit.runner.RunWith; import org.mockito.Mock; import static org.mockito.Mockito.when; -import org.mockito.runners.MockitoJUnitRunner; +import org.mockito.junit.MockitoJUnitRunner; /** * diff --git a/cygnus-common/src/test/java/com/telefonica/iot/cygnus/backends/ckan/CKANCacheTest.java b/cygnus-common/src/test/java/com/telefonica/iot/cygnus/backends/ckan/CKANCacheTest.java index 59cbee4e3..0d2fbb1e3 100644 --- a/cygnus-common/src/test/java/com/telefonica/iot/cygnus/backends/ckan/CKANCacheTest.java +++ b/cygnus-common/src/test/java/com/telefonica/iot/cygnus/backends/ckan/CKANCacheTest.java @@ -28,7 +28,7 @@ import org.junit.runner.RunWith; import org.mockito.Mock; import static org.mockito.Mockito.when; -import org.mockito.runners.MockitoJUnitRunner; +import org.mockito.junit.MockitoJUnitRunner; /** * diff --git a/cygnus-common/src/test/java/com/telefonica/iot/cygnus/backends/dynamo/DynamoDBBackendImplTest.java b/cygnus-common/src/test/java/com/telefonica/iot/cygnus/backends/dynamo/DynamoDBBackendImplTest.java index cc1d328a2..5211174ed 100644 --- a/cygnus-common/src/test/java/com/telefonica/iot/cygnus/backends/dynamo/DynamoDBBackendImplTest.java +++ b/cygnus-common/src/test/java/com/telefonica/iot/cygnus/backends/dynamo/DynamoDBBackendImplTest.java @@ -29,7 +29,7 @@ import org.junit.runner.RunWith; import org.mockito.Mock; import static org.mockito.Mockito.when; -import org.mockito.runners.MockitoJUnitRunner; +import org.mockito.junit.MockitoJUnitRunner; /** * diff --git a/cygnus-common/src/test/java/com/telefonica/iot/cygnus/backends/hdfs/HDFSBackendImplBinaryTest.java b/cygnus-common/src/test/java/com/telefonica/iot/cygnus/backends/hdfs/HDFSBackendImplBinaryTest.java index 20105890c..64a28c9b1 100644 --- a/cygnus-common/src/test/java/com/telefonica/iot/cygnus/backends/hdfs/HDFSBackendImplBinaryTest.java +++ b/cygnus-common/src/test/java/com/telefonica/iot/cygnus/backends/hdfs/HDFSBackendImplBinaryTest.java @@ -26,7 +26,7 @@ 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.*; // this is required by "fail" like assertions import org.mockito.Mockito; import static org.mockito.Mockito.when; diff --git a/cygnus-common/src/test/java/com/telefonica/iot/cygnus/backends/hdfs/HDFSBackendImplRESTTest.java b/cygnus-common/src/test/java/com/telefonica/iot/cygnus/backends/hdfs/HDFSBackendImplRESTTest.java index 8f98acdac..49738fe2e 100644 --- a/cygnus-common/src/test/java/com/telefonica/iot/cygnus/backends/hdfs/HDFSBackendImplRESTTest.java +++ b/cygnus-common/src/test/java/com/telefonica/iot/cygnus/backends/hdfs/HDFSBackendImplRESTTest.java @@ -28,7 +28,7 @@ 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.*; // this is required by "fail" like assertions import static org.mockito.Mockito.*; // this is required by "when" like functions diff --git a/cygnus-common/src/test/java/com/telefonica/iot/cygnus/backends/http/HttpBackendTest.java b/cygnus-common/src/test/java/com/telefonica/iot/cygnus/backends/http/HttpBackendTest.java index e703cae96..08e71ec22 100644 --- a/cygnus-common/src/test/java/com/telefonica/iot/cygnus/backends/http/HttpBackendTest.java +++ b/cygnus-common/src/test/java/com/telefonica/iot/cygnus/backends/http/HttpBackendTest.java @@ -33,7 +33,7 @@ import static org.junit.Assert.assertTrue; import org.junit.Test; import org.junit.runner.RunWith; -import org.mockito.runners.MockitoJUnitRunner; +import org.mockito.junit.MockitoJUnitRunner; /** * @@ -368,4 +368,4 @@ public void testFinishTransaction() { } // try catch } // testFinishTransaction -} // HttpBackendTest \ No newline at end of file +} // HttpBackendTest diff --git a/cygnus-common/src/test/java/com/telefonica/iot/cygnus/backends/http/JsonResponseTest.java b/cygnus-common/src/test/java/com/telefonica/iot/cygnus/backends/http/JsonResponseTest.java index f4fb57534..1c93524ce 100644 --- a/cygnus-common/src/test/java/com/telefonica/iot/cygnus/backends/http/JsonResponseTest.java +++ b/cygnus-common/src/test/java/com/telefonica/iot/cygnus/backends/http/JsonResponseTest.java @@ -29,7 +29,7 @@ import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; -import org.mockito.runners.MockitoJUnitRunner; +import org.mockito.junit.MockitoJUnitRunner; /** * diff --git a/cygnus-common/src/test/java/com/telefonica/iot/cygnus/backends/kafka/KafkaBackendImplTest.java b/cygnus-common/src/test/java/com/telefonica/iot/cygnus/backends/kafka/KafkaBackendImplTest.java index ee430de96..fd5515fd2 100644 --- a/cygnus-common/src/test/java/com/telefonica/iot/cygnus/backends/kafka/KafkaBackendImplTest.java +++ b/cygnus-common/src/test/java/com/telefonica/iot/cygnus/backends/kafka/KafkaBackendImplTest.java @@ -33,7 +33,7 @@ import org.mockito.Mock; import org.mockito.Mockito; import static org.mockito.Mockito.when; -import org.mockito.runners.MockitoJUnitRunner; +import org.mockito.junit.MockitoJUnitRunner; /** * diff --git a/cygnus-common/src/test/java/com/telefonica/iot/cygnus/backends/sql/SQLBackendImplTest.java b/cygnus-common/src/test/java/com/telefonica/iot/cygnus/backends/sql/SQLBackendImplTest.java index d31c35fd4..f3f8d06b3 100644 --- a/cygnus-common/src/test/java/com/telefonica/iot/cygnus/backends/sql/SQLBackendImplTest.java +++ b/cygnus-common/src/test/java/com/telefonica/iot/cygnus/backends/sql/SQLBackendImplTest.java @@ -25,7 +25,7 @@ import org.junit.runner.RunWith; import org.mockito.Mock; import org.mockito.Mockito; -import org.mockito.runners.MockitoJUnitRunner; +import org.mockito.junit.MockitoJUnitRunner; import java.sql.Connection; import java.sql.Statement; diff --git a/cygnus-common/src/test/java/com/telefonica/iot/cygnus/backends/sql/SQLQueryUtilsTest.java b/cygnus-common/src/test/java/com/telefonica/iot/cygnus/backends/sql/SQLQueryUtilsTest.java index 5a63c3e33..ad8150df8 100644 --- a/cygnus-common/src/test/java/com/telefonica/iot/cygnus/backends/sql/SQLQueryUtilsTest.java +++ b/cygnus-common/src/test/java/com/telefonica/iot/cygnus/backends/sql/SQLQueryUtilsTest.java @@ -26,7 +26,7 @@ import static com.telefonica.iot.cygnus.utils.CommonUtilsForTests.getTestTraceHead; import static org.junit.Assert.assertEquals; -import static org.mockito.Matchers.anyString; +import static org.mockito.ArgumentMatchers.anyString; import static org.mockito.Mockito.*; import java.sql.Connection; diff --git a/cygnus-common/src/test/java/com/telefonica/iot/cygnus/channelselectors/RoundRobinChannelSelectorTest.java b/cygnus-common/src/test/java/com/telefonica/iot/cygnus/channelselectors/RoundRobinChannelSelectorTest.java index c8327c0a6..414750e98 100644 --- a/cygnus-common/src/test/java/com/telefonica/iot/cygnus/channelselectors/RoundRobinChannelSelectorTest.java +++ b/cygnus-common/src/test/java/com/telefonica/iot/cygnus/channelselectors/RoundRobinChannelSelectorTest.java @@ -29,7 +29,7 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Mock; -import org.mockito.runners.MockitoJUnitRunner; +import org.mockito.junit.MockitoJUnitRunner; /** * diff --git a/cygnus-common/src/test/java/com/telefonica/iot/cygnus/management/ManagementInterfaceTest.java b/cygnus-common/src/test/java/com/telefonica/iot/cygnus/management/ManagementInterfaceTest.java index 12a9c8a83..7e4921155 100644 --- a/cygnus-common/src/test/java/com/telefonica/iot/cygnus/management/ManagementInterfaceTest.java +++ b/cygnus-common/src/test/java/com/telefonica/iot/cygnus/management/ManagementInterfaceTest.java @@ -33,7 +33,7 @@ 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.*; import static org.mockito.Mockito.*; // this is required by "when" like functions import static com.telefonica.iot.cygnus.utils.CommonUtilsForTests.getTestTraceHead; diff --git a/cygnus-common/src/test/java/com/telefonica/iot/cygnus/utils/CommonUtilsTest.java b/cygnus-common/src/test/java/com/telefonica/iot/cygnus/utils/CommonUtilsTest.java index 5c52df4b7..6c559355d 100644 --- a/cygnus-common/src/test/java/com/telefonica/iot/cygnus/utils/CommonUtilsTest.java +++ b/cygnus-common/src/test/java/com/telefonica/iot/cygnus/utils/CommonUtilsTest.java @@ -31,7 +31,7 @@ import static org.junit.Assert.assertTrue; import org.junit.Test; import org.junit.runner.RunWith; -import org.mockito.runners.MockitoJUnitRunner; +import org.mockito.junit.MockitoJUnitRunner; /** * diff --git a/cygnus-ngsi/pom.xml b/cygnus-ngsi/pom.xml index d09e558d2..20fe49a3c 100644 --- a/cygnus-ngsi/pom.xml +++ b/cygnus-ngsi/pom.xml @@ -19,8 +19,8 @@ org.mockito - mockito-all - 1.9.5 + mockito-core + 5.5.0 test diff --git a/cygnus-ngsi/src/test/java/com/telefonica/iot/cygnus/handlers/NGSIRestHandlerTest.java b/cygnus-ngsi/src/test/java/com/telefonica/iot/cygnus/handlers/NGSIRestHandlerTest.java index d7992f9d9..2c9c408af 100644 --- a/cygnus-ngsi/src/test/java/com/telefonica/iot/cygnus/handlers/NGSIRestHandlerTest.java +++ b/cygnus-ngsi/src/test/java/com/telefonica/iot/cygnus/handlers/NGSIRestHandlerTest.java @@ -39,7 +39,7 @@ import static org.junit.Assert.*; // this is required by "fail" like assertions import org.junit.Before; import org.junit.runner.RunWith; -import org.mockito.runners.MockitoJUnitRunner; +import org.mockito.junit.MockitoJUnitRunner; import org.junit.Test; import org.mockito.Mock; import static org.mockito.Mockito.when; diff --git a/cygnus-ngsi/src/test/java/com/telefonica/iot/cygnus/sinks/NGSIArcGisSinkTest.java b/cygnus-ngsi/src/test/java/com/telefonica/iot/cygnus/sinks/NGSIArcGisSinkTest.java index 74b08c861..02a4a3eff 100644 --- a/cygnus-ngsi/src/test/java/com/telefonica/iot/cygnus/sinks/NGSIArcGisSinkTest.java +++ b/cygnus-ngsi/src/test/java/com/telefonica/iot/cygnus/sinks/NGSIArcGisSinkTest.java @@ -31,7 +31,7 @@ import org.junit.runner.RunWith; import org.mockito.Mock; import org.mockito.Mockito; -import org.mockito.runners.MockitoJUnitRunner; +import org.mockito.junit.MockitoJUnitRunner; import com.google.gson.JsonElement; import com.google.gson.JsonParser; @@ -50,137 +50,133 @@ @RunWith(MockitoJUnitRunner.class) public class NGSIArcGisSinkTest implements ArcgisBaseTest{ - private static final CygnusLogger LOGGER = new CygnusLogger(NGSIArcGisSinkTest.class); - private NGSIArcgisFeatureTableSink sink; - - @Mock - private NGSIArcgisFeatureTable mockArcgisLog; - - public class SinkTest extends NGSIArcgisFeatureTableSink { - public SinkTest() { - } - - /* - * (non-Javadoc) - * - * @see com.telefonica.iot.cygnus.sinks.NGSIArcgisFeatureTableSink# - * jsonElementToFeatureAttr(java.lang.String, java.lang.String, - * com.google.gson.JsonElement, es.santander.smartcity.model.Feature) - */ - @Override - public void jsonElementToFeatureAttr(String attrName, String attrType, JsonElement attrValue, Feature feature) { - super.jsonElementToFeatureAttr(attrName, attrType, attrValue, feature); - } - - } - - /** - * Constructor. - */ - public NGSIArcGisSinkTest() { - } // NGSIArcGisSinkTest - - /** - * @throws Exception - * - */ - @Before - public void setup() throws Exception { - Mockito.doNothing().when(mockArcgisLog).addToBatch(Mockito.any(Feature.class)); - Mockito.doNothing().when(mockArcgisLog).addToBatch(Mockito.anyList()); - Mockito.when(mockArcgisLog.connected()).thenReturn(true); - - } // setup - - /** - * [NGSIArcGisSink.pointToFeatureAttr] -------- geo:json point parsed to - * feature attribute. - */ - @Test - public void pointToFeatureAttr() { - LOGGER.debug(getTestTraceHead("[NGSIArcGISBaseSink.insertFeature]") - + "-------- geo:json point parsed to feature attribute"); - - NGSIArcgisFeatureTableSink sink = new SinkTest(); - - String geoPoint = "{\"coordinates\":[-3.798105176,43.464492254],\"type\":\"Point\"}"; - - JsonParser parser = new JsonParser(); - JsonElement jsonElement = parser.parse(geoPoint); - Feature feature = Feature.createPointFeature(0, 0); - - sink.jsonElementToFeatureAttr("name", "geo:json", jsonElement, feature); - - String featureTableUrl = "https://arcgis.com//XXXXXXXXXXXX//arcgis/rest/services/FeatureTable01/FeatureServer/0"; - featureTableUrl = featureTableUrl.replaceAll("([^:])\\/\\/", "$1/"); - - System.out.println(featureTableUrl); - - assertTrue(feature.getGeometry() != null); - } - - /** - * [NGSIArcGisSink.insertFeature] -------- When service-path is notified, - * NGSIArcGisSink send entities to GIS. - */ - @Test - public void testInsertFeature() { - LOGGER.debug(getTestTraceHead("[NGSIArcGISBaseSink.insertFeature]") - + "-------- When / service-path is notified/defaulted, NGSIArcGisSink send entities to GIS."); + private static final CygnusLogger LOGGER = new CygnusLogger(NGSIArcGisSinkTest.class); + private NGSIArcgisFeatureTableSink sink; + + @Mock + private NGSIArcgisFeatureTable mockArcgisLog; + + public class SinkTest extends NGSIArcgisFeatureTableSink { + public SinkTest() { + } + + /* + * (non-Javadoc) + * + * @see com.telefonica.iot.cygnus.sinks.NGSIArcgisFeatureTableSink# + * jsonElementToFeatureAttr(java.lang.String, java.lang.String, + * com.google.gson.JsonElement, es.santander.smartcity.model.Feature) + */ + @Override + public void jsonElementToFeatureAttr(String attrName, String attrType, JsonElement attrValue, Feature feature) { + super.jsonElementToFeatureAttr(attrName, attrType, attrValue, feature); + } + + } + + /** + * Constructor. + */ + public NGSIArcGisSinkTest() { + } // NGSIArcGisSinkTest + + /** + * @throws Exception + * + */ + @Before + public void setup() throws Exception { + } // setup + + /** + * [NGSIArcGisSink.pointToFeatureAttr] -------- geo:json point parsed to + * feature attribute. + */ + @Test + public void pointToFeatureAttr() { + LOGGER.debug(getTestTraceHead("[NGSIArcGISBaseSink.insertFeature]") + + "-------- geo:json point parsed to feature attribute"); + + NGSIArcgisFeatureTableSink sink = new SinkTest(); + + String geoPoint = "{\"coordinates\":[-3.798105176,43.464492254],\"type\":\"Point\"}"; + + JsonParser parser = new JsonParser(); + JsonElement jsonElement = parser.parse(geoPoint); + Feature feature = Feature.createPointFeature(0, 0); + + sink.jsonElementToFeatureAttr("name", "geo:json", jsonElement, feature); + + String featureTableUrl = "https://arcgis.com//XXXXXXXXXXXX//arcgis/rest/services/FeatureTable01/FeatureServer/0"; + featureTableUrl = featureTableUrl.replaceAll("([^:])\\/\\/", "$1/"); + + System.out.println(featureTableUrl); + + assertTrue(feature.getGeometry() != null); + } + + /** + * [NGSIArcGisSink.insertFeature] -------- When service-path is notified, + * NGSIArcGisSink send entities to GIS. + */ + @Test + public void testInsertFeature() { + LOGGER.debug(getTestTraceHead("[NGSIArcGISBaseSink.insertFeature]") + + "-------- When / service-path is notified/defaulted, NGSIArcGisSink send entities to GIS."); if (!ArcgisBaseTest.connectionTestsSkipped()){ - try { - String bodyJSON = "{\"id\": \"Car1\", \"type\": \"Car\", " - + "\"location\": { \"type\": \"geo:json\" \"value\": " - + "{\"type\": \"Point\", \"coordinates\": [-3.79109661, 43.48712556]}}, " - + " \"speed\": { \"type\":\"Float\", \"value\": 98 } }"; - String serviceFiware = "service"; - String servicePathFiware = "/test"; + try { + String bodyJSON = "{\"id\": \"Car1\", \"type\": \"Car\", " + + "\"location\": { \"type\": \"geo:json\" \"value\": " + + "{\"type\": \"Point\", \"coordinates\": [-3.79109661, 43.48712556]}}, " + + " \"speed\": { \"type\":\"Float\", \"value\": 98 } }"; + String serviceFiware = "service"; + String servicePathFiware = "/test"; - Map headers = new HashMap(); - headers.put(NGSIConstants.FLUME_HEADER_MAPPED_SERVICE, serviceFiware); - headers.put(NGSIConstants.FLUME_HEADER_MAPPED_SERVICE_PATH, servicePathFiware); + Map headers = new HashMap(); + headers.put(NGSIConstants.FLUME_HEADER_MAPPED_SERVICE, serviceFiware); + headers.put(NGSIConstants.FLUME_HEADER_MAPPED_SERVICE_PATH, servicePathFiware); - String url = ArcgisBaseTest.getFeatureUrl(); - String username = ArcgisBaseTest.getUser(); - String password = ArcgisBaseTest.getPassword(); + String url = ArcgisBaseTest.getFeatureUrl(); + String username = ArcgisBaseTest.getUser(); + String password = ArcgisBaseTest.getPassword(); - sink = new NGSIArcgisFeatureTableSink(); + sink = new NGSIArcgisFeatureTableSink(); - Context context = NGSIUtilsForTests.createContextForArcGis(url, username, password); - sink.configure(context); + Context context = NGSIUtilsForTests.createContextForArcGis(url, username, password); + sink.configure(context); - JSONParser jsonParser = new JSONParser(); - JSONObject json = (JSONObject) jsonParser.parse(bodyJSON); + JSONParser jsonParser = new JSONParser(); + JSONObject json = (JSONObject) jsonParser.parse(bodyJSON); - NGSIArcgisFeatureTableSink.ArcgisAggregatorDomain arcGisDomain = null; - String serviceUrl = "127.0.0.1/services"; + NGSIArcgisFeatureTableSink.ArcgisAggregatorDomain arcGisDomain = null; + String serviceUrl = "127.0.0.1/services"; - NGSIArcgisFeatureTableSink.NGSIArcgisAggregator aggregator = sink.new NGSIArcgisAggregator(serviceUrl, - false); - NGSIEvent event = null; + NGSIArcgisFeatureTableSink.NGSIArcgisAggregator aggregator = sink.new NGSIArcgisAggregator(serviceUrl, + false); + NGSIEvent event = null; - aggregator.aggregate(event); - try { - sink.persistAggregation(aggregator); - assertTrue(true); - LOGGER.debug(getTestTraceHead("[NGSIArcGisSink.insertFeeature]") + "- OKs"); - } catch (AssertionError e) { - LOGGER.error(getTestTraceHead("[NGSIArcGisSink.insertFeeature]") + "- FAIL"); - throw e; - } // try catch - } catch (Exception e) { - e.printStackTrace(); - LOGGER.error(getTestTraceHead("[NGSIArcGisSink.insertFeeature]") + "- FAIL"); + aggregator.aggregate(event); + try { + sink.persistAggregation(aggregator); + assertTrue(true); + LOGGER.debug(getTestTraceHead("[NGSIArcGisSink.insertFeeature]") + "- OKs"); + } catch (AssertionError e) { + LOGGER.error(getTestTraceHead("[NGSIArcGisSink.insertFeeature]") + "- FAIL"); + throw e; + } // try catch + } catch (Exception e) { + e.printStackTrace(); + LOGGER.error(getTestTraceHead("[NGSIArcGisSink.insertFeeature]") + "- FAIL"); - assertTrue(false); + assertTrue(false); - } // catch + } // catch } else { System.out.println(" -- Skipped"); assertTrue(true); } - } // testInsertFeature + } // testInsertFeature } // NGSIArcGisSinkTest diff --git a/cygnus-ngsi/src/test/java/com/telefonica/iot/cygnus/sinks/NGSICKANSinkTest.java b/cygnus-ngsi/src/test/java/com/telefonica/iot/cygnus/sinks/NGSICKANSinkTest.java index fa22a7234..7faa83e9c 100644 --- a/cygnus-ngsi/src/test/java/com/telefonica/iot/cygnus/sinks/NGSICKANSinkTest.java +++ b/cygnus-ngsi/src/test/java/com/telefonica/iot/cygnus/sinks/NGSICKANSinkTest.java @@ -38,7 +38,7 @@ import com.telefonica.iot.cygnus.utils.NGSIConstants; import com.telefonica.iot.cygnus.utils.NGSIUtils; import org.junit.runner.RunWith; -import org.mockito.runners.MockitoJUnitRunner; +import org.mockito.junit.MockitoJUnitRunner; import org.apache.flume.Context; import org.apache.logging.log4j.Level; import org.apache.logging.log4j.LogManager; diff --git a/cygnus-ngsi/src/test/java/com/telefonica/iot/cygnus/sinks/NGSIElasticsearchSinkTest.java b/cygnus-ngsi/src/test/java/com/telefonica/iot/cygnus/sinks/NGSIElasticsearchSinkTest.java index 281c462d1..91cdeaeb1 100644 --- a/cygnus-ngsi/src/test/java/com/telefonica/iot/cygnus/sinks/NGSIElasticsearchSinkTest.java +++ b/cygnus-ngsi/src/test/java/com/telefonica/iot/cygnus/sinks/NGSIElasticsearchSinkTest.java @@ -64,10 +64,10 @@ import org.junit.runner.RunWith; import org.junit.runners.Parameterized; import org.junit.runners.Parameterized.Parameters; -import static org.mockito.Matchers.anyString; +import static org.mockito.ArgumentMatchers.anyString; import org.mockito.ArgumentCaptor; import org.mockito.Captor; -import org.mockito.Matchers; +import org.mockito.ArgumentMatchers; import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.MockitoAnnotations; @@ -444,7 +444,7 @@ public void setUp() throws Exception { }); MockitoAnnotations.initMocks(this); - when(mockBackend.bulkInsert(anyString(), anyString(), Matchers.>>any())).thenReturn(null); + when(mockBackend.bulkInsert(anyString(), anyString(), ArgumentMatchers.>>any())).thenReturn(null); } /** @@ -467,7 +467,7 @@ public void testStartAndStopInternalWithoutCache() { sink.startInternal(); try { - verify(mockBackend, times(0)).bulkInsert(anyString(), anyString(), Matchers.>>any()); + verify(mockBackend, times(0)).bulkInsert(anyString(), anyString(), ArgumentMatchers.>>any()); } catch (Exception e) { fail(e.getMessage()); } @@ -503,7 +503,7 @@ public void testStartAndStopInternalWithCache() { sink.startInternal(); try { - verify(mockBackend, times(0)).bulkInsert(anyString(), anyString(), Matchers.>>any()); + verify(mockBackend, times(0)).bulkInsert(anyString(), anyString(), ArgumentMatchers.>>any()); } catch (Exception e) { fail(e.getMessage()); } @@ -516,7 +516,7 @@ public void testStartAndStopInternalWithCache() { } sink.setAggregations(aggregations); try { - verify(mockBackend, times(0)).bulkInsert(anyString(), anyString(), Matchers.>>any()); + verify(mockBackend, times(0)).bulkInsert(anyString(), anyString(), ArgumentMatchers.>>any()); } catch (Exception e) { fail(e.getMessage()); } @@ -725,7 +725,7 @@ public void setUp() throws Exception { false, null); MockitoAnnotations.initMocks(this); - when(mockBackend.bulkInsert(anyString(), anyString(), Matchers.>>any())).thenReturn(null); + when(mockBackend.bulkInsert(anyString(), anyString(), ArgumentMatchers.>>any())).thenReturn(null); } // setUp @Ignore @@ -767,7 +767,7 @@ public void testPersistBatchWithoutData() { try { sink.persistBatch(null); - verify(mockBackend, times(0)).bulkInsert(anyString(), anyString(), Matchers.>>any()); + verify(mockBackend, times(0)).bulkInsert(anyString(), anyString(), ArgumentMatchers.>>any()); } catch (Exception e) { fail(e.getMessage()); } diff --git a/cygnus-ngsi/src/test/java/com/telefonica/iot/cygnus/sinks/NGSIOracleSQLSinkTest.java b/cygnus-ngsi/src/test/java/com/telefonica/iot/cygnus/sinks/NGSIOracleSQLSinkTest.java index 218e8fbcf..0987422d2 100644 --- a/cygnus-ngsi/src/test/java/com/telefonica/iot/cygnus/sinks/NGSIOracleSQLSinkTest.java +++ b/cygnus-ngsi/src/test/java/com/telefonica/iot/cygnus/sinks/NGSIOracleSQLSinkTest.java @@ -35,7 +35,7 @@ import org.apache.log4j.LogManager; import org.junit.Test; import org.junit.runner.RunWith; -import org.mockito.runners.MockitoJUnitRunner; +import org.mockito.junit.MockitoJUnitRunner; import java.util.ArrayList; import java.util.HashMap; diff --git a/cygnus-ngsi/src/test/java/com/telefonica/iot/cygnus/sinks/NGSIOrionBaseSinkTest.java b/cygnus-ngsi/src/test/java/com/telefonica/iot/cygnus/sinks/NGSIOrionBaseSinkTest.java index ad7f32fd1..461f04f50 100644 --- a/cygnus-ngsi/src/test/java/com/telefonica/iot/cygnus/sinks/NGSIOrionBaseSinkTest.java +++ b/cygnus-ngsi/src/test/java/com/telefonica/iot/cygnus/sinks/NGSIOrionBaseSinkTest.java @@ -32,7 +32,7 @@ import org.junit.runner.RunWith; import org.mockito.Mock; import org.mockito.Mockito; -import org.mockito.runners.MockitoJUnitRunner; +import org.mockito.junit.MockitoJUnitRunner; import com.telefonica.iot.cygnus.backends.orion.OrionBackend; import com.telefonica.iot.cygnus.log.CygnusLogger; diff --git a/cygnus-ngsi/src/test/java/com/telefonica/iot/cygnus/sinks/NGSIPostgisSinkTest.java b/cygnus-ngsi/src/test/java/com/telefonica/iot/cygnus/sinks/NGSIPostgisSinkTest.java index 13253616b..ea39de719 100644 --- a/cygnus-ngsi/src/test/java/com/telefonica/iot/cygnus/sinks/NGSIPostgisSinkTest.java +++ b/cygnus-ngsi/src/test/java/com/telefonica/iot/cygnus/sinks/NGSIPostgisSinkTest.java @@ -46,7 +46,7 @@ import org.apache.logging.log4j.core.config.LoggerConfig; import org.junit.Test; import org.junit.runner.RunWith; -import org.mockito.runners.MockitoJUnitRunner; +import org.mockito.junit.MockitoJUnitRunner; /** * diff --git a/cygnus-ngsi/src/test/java/com/telefonica/iot/cygnus/sinks/NGSIPostgreSQLSinkTest.java b/cygnus-ngsi/src/test/java/com/telefonica/iot/cygnus/sinks/NGSIPostgreSQLSinkTest.java index 9707802ad..910556686 100644 --- a/cygnus-ngsi/src/test/java/com/telefonica/iot/cygnus/sinks/NGSIPostgreSQLSinkTest.java +++ b/cygnus-ngsi/src/test/java/com/telefonica/iot/cygnus/sinks/NGSIPostgreSQLSinkTest.java @@ -38,7 +38,7 @@ import org.apache.logging.log4j.core.config.LoggerConfig; import org.junit.Test; import org.junit.runner.RunWith; -import org.mockito.runners.MockitoJUnitRunner; +import org.mockito.junit.MockitoJUnitRunner; import java.util.ArrayList; import java.util.HashMap;