This is an automated email from the ASF dual-hosted git repository.
FrankChen021 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/druid.git
The following commit(s) were added to refs/heads/master by this push:
new 6548e2719be Replace deprecated JUnit assertThat calls (#19819)
6548e2719be is described below
commit 6548e2719be9d1ea5a67dfd2ed549cd3fc7f6bb5
Author: Frank Chen <[email protected]>
AuthorDate: Tue Aug 4 10:22:20 2026 +0800
Replace deprecated JUnit assertThat calls (#19819)
---
codestyle/druid-forbidden-apis.txt | 3 +
...pressedBigDecimalAggregatorGroupByTestBase.java | 11 ++--
...ssedBigDecimalAggregatorTimeseriesTestBase.java | 2 +-
.../movingaverage/MovingAverageIterableTest.java | 3 +-
.../movingaverage/MovingAverageQueryTest.java | 5 +-
.../averagers/DoubleMaxAveragerFactoryTest.java | 4 +-
.../averagers/DoubleMeanAveragerFactoryTest.java | 4 +-
.../DoubleMeanNoNullAveragerFactoryTest.java | 4 +-
.../averagers/DoubleMinAveragerFactoryTest.java | 4 +-
.../averagers/DoubleSumAveragerFactoryTest.java | 4 +-
.../averagers/LongMaxAveragerFactoryTest.java | 4 +-
.../averagers/LongMeanAveragerFactoryTest.java | 4 +-
.../LongMeanNoNullAveragerFactoryTest.java | 4 +-
.../averagers/LongMinAveragerFactoryTest.java | 4 +-
.../averagers/LongSumAveragerFactoryTest.java | 4 +-
.../ToObjectVectorColumnProcessorFactoryTest.java | 3 +-
.../query/aggregation/histogram/QuantilesTest.java | 3 +-
.../parallel/ParallelIndexSupervisorTaskTest.java | 2 +-
.../PartialHashSegmentGenerateTaskTest.java | 3 +-
...ngePartitionMultiPhaseParallelIndexingTest.java | 5 +-
.../parallel/distribution/StringSketchTest.java | 11 ++--
...titionIndexTaskInputRowIteratorBuilderTest.java | 3 +-
.../druid/indexing/input/DruidInputSourceTest.java | 7 ++-
.../overlord/SingleTaskBackgroundRunnerTest.java | 3 +-
.../druid/segment/join/HashJoinSegmentTest.java | 3 +-
.../org/apache/druid/utils/CloseableUtilsTest.java | 65 +++++++++++-----------
.../apache/druid/curator/CuratorModuleTest.java | 2 +-
.../druid/segment/InlineSegmentWranglerTest.java | 3 +-
.../druid/segment/LookupSegmentWranglerTest.java | 3 +-
.../segment/join/LookupJoinableFactoryTest.java | 3 +-
.../druid/server/emitter/EmitterModuleTest.java | 5 +-
.../log/LoggingRequestLoggerProviderTest.java | 3 +-
.../server/log/RequestLoggerProviderTest.java | 4 +-
33 files changed, 108 insertions(+), 87 deletions(-)
diff --git a/codestyle/druid-forbidden-apis.txt
b/codestyle/druid-forbidden-apis.txt
index 331c1a74352..87692043dcf 100644
--- a/codestyle/druid-forbidden-apis.txt
+++ b/codestyle/druid-forbidden-apis.txt
@@ -96,3 +96,6 @@ javax.annotation.concurrent.GuardedBy
com.amazonaws.annotation.GuardedBy
org.powermock.** @ Use Mockito instead of Powermock for compatibility with
newer Java versions
+
+org.junit.Assert#assertThat(java.lang.Object,org.hamcrest.Matcher) @ Use
org.hamcrest.MatcherAssert#assertThat instead
+org.junit.Assert#assertThat(java.lang.String,java.lang.Object,org.hamcrest.Matcher)
@ Use org.hamcrest.MatcherAssert#assertThat instead
diff --git
a/extensions-contrib/compressed-bigdecimal/src/test/java/org/apache/druid/compressedbigdecimal/aggregator/CompressedBigDecimalAggregatorGroupByTestBase.java
b/extensions-contrib/compressed-bigdecimal/src/test/java/org/apache/druid/compressedbigdecimal/aggregator/CompressedBigDecimalAggregatorGroupByTestBase.java
index 63213de00c6..908957c786e 100644
---
a/extensions-contrib/compressed-bigdecimal/src/test/java/org/apache/druid/compressedbigdecimal/aggregator/CompressedBigDecimalAggregatorGroupByTestBase.java
+++
b/extensions-contrib/compressed-bigdecimal/src/test/java/org/apache/druid/compressedbigdecimal/aggregator/CompressedBigDecimalAggregatorGroupByTestBase.java
@@ -28,6 +28,7 @@ import org.apache.druid.java.util.common.guava.Sequence;
import org.apache.druid.query.aggregation.AggregationTestHelper;
import org.apache.druid.query.groupby.GroupByQueryConfig;
import org.apache.druid.query.groupby.ResultRow;
+import org.hamcrest.MatcherAssert;
import org.hamcrest.collection.IsCollectionWithSize;
import org.hamcrest.collection.IsMapContaining;
import org.hamcrest.collection.IsMapWithSize;
@@ -107,7 +108,7 @@ public abstract class
CompressedBigDecimalAggregatorGroupByTestBase
);
List<ResultRow> results = seq.toList();
- Assert.assertThat(results, IsCollectionWithSize.hasSize(1));
+ MatcherAssert.assertThat(results, IsCollectionWithSize.hasSize(1));
ResultRow row = results.get(0);
MapBasedRow mapBasedRow =
row.toMapBasedRow(cbdGroupByQueryConfig.getQuery());
Map<String, Object> event = mapBasedRow.getEvent();
@@ -115,8 +116,8 @@ public abstract class
CompressedBigDecimalAggregatorGroupByTestBase
new DateTime("2017-01-01T00:00:00Z",
DateTimeZone.forTimeZone(TimeZone.getTimeZone("UTC"))),
mapBasedRow.getTimestamp()
);
- Assert.assertThat(event, IsMapWithSize.aMapWithSize(3));
- Assert.assertThat(
+ MatcherAssert.assertThat(event, IsMapWithSize.aMapWithSize(3));
+ MatcherAssert.assertThat(
event,
IsMapContaining.hasEntry(
"cbdRevenueFromString",
@@ -124,7 +125,7 @@ public abstract class
CompressedBigDecimalAggregatorGroupByTestBase
)
);
// long conversion of 5000000000.000000005 results in null/0 value
- Assert.assertThat(
+ MatcherAssert.assertThat(
event,
IsMapContaining.hasEntry(
"cbdRevenueFromLong",
@@ -132,7 +133,7 @@ public abstract class
CompressedBigDecimalAggregatorGroupByTestBase
)
);
// double input changes 5000000000.000000005 to 5000000000.5 to fit in
double mantissa space
- Assert.assertThat(
+ MatcherAssert.assertThat(
event,
IsMapContaining.hasEntry(
"cbdRevenueFromDouble",
diff --git
a/extensions-contrib/compressed-bigdecimal/src/test/java/org/apache/druid/compressedbigdecimal/aggregator/CompressedBigDecimalAggregatorTimeseriesTestBase.java
b/extensions-contrib/compressed-bigdecimal/src/test/java/org/apache/druid/compressedbigdecimal/aggregator/CompressedBigDecimalAggregatorTimeseriesTestBase.java
index f2e4921a500..f9f2073622d 100644
---
a/extensions-contrib/compressed-bigdecimal/src/test/java/org/apache/druid/compressedbigdecimal/aggregator/CompressedBigDecimalAggregatorTimeseriesTestBase.java
+++
b/extensions-contrib/compressed-bigdecimal/src/test/java/org/apache/druid/compressedbigdecimal/aggregator/CompressedBigDecimalAggregatorTimeseriesTestBase.java
@@ -53,10 +53,10 @@ import java.util.List;
import java.util.Map;
import java.util.TimeZone;
+import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.collection.IsMapContaining.hasEntry;
import static org.hamcrest.collection.IsMapWithSize.aMapWithSize;
import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertThat;
public abstract class CompressedBigDecimalAggregatorTimeseriesTestBase extends
InitializedNullHandlingTest
{
diff --git
a/extensions-contrib/moving-average-query/src/test/java/org/apache/druid/query/movingaverage/MovingAverageIterableTest.java
b/extensions-contrib/moving-average-query/src/test/java/org/apache/druid/query/movingaverage/MovingAverageIterableTest.java
index 9463bd87f71..167ac95a28d 100644
---
a/extensions-contrib/moving-average-query/src/test/java/org/apache/druid/query/movingaverage/MovingAverageIterableTest.java
+++
b/extensions-contrib/moving-average-query/src/test/java/org/apache/druid/query/movingaverage/MovingAverageIterableTest.java
@@ -35,6 +35,7 @@ import
org.apache.druid.query.movingaverage.averagers.ConstantAveragerFactory;
import org.apache.druid.query.movingaverage.averagers.LongMeanAveragerFactory;
import org.apache.druid.testing.InitializedNullHandlingTest;
import org.hamcrest.CoreMatchers;
+import org.hamcrest.MatcherAssert;
import org.joda.time.DateTime;
import org.joda.time.chrono.ISOChronology;
import org.junit.Assert;
@@ -144,7 +145,7 @@ public class MovingAverageIterableTest extends
InitializedNullHandlingTest
r = iter.next();
Assert.assertEquals(JAN_3, r.getTimestamp());
Assert.assertEquals("US", r.getRaw(COUNTRY));
- Assert.assertThat(r.getRaw(AGE),
CoreMatchers.not(CoreMatchers.equalTo(r2.getRaw(AGE))));
+ MatcherAssert.assertThat(r.getRaw(AGE),
CoreMatchers.not(CoreMatchers.equalTo(r2.getRaw(AGE))));
Assert.assertTrue(iter.hasNext());
r = iter.next();
diff --git
a/extensions-contrib/moving-average-query/src/test/java/org/apache/druid/query/movingaverage/MovingAverageQueryTest.java
b/extensions-contrib/moving-average-query/src/test/java/org/apache/druid/query/movingaverage/MovingAverageQueryTest.java
index d16895dc771..7072b974fac 100644
---
a/extensions-contrib/moving-average-query/src/test/java/org/apache/druid/query/movingaverage/MovingAverageQueryTest.java
+++
b/extensions-contrib/moving-average-query/src/test/java/org/apache/druid/query/movingaverage/MovingAverageQueryTest.java
@@ -78,6 +78,7 @@ import
org.apache.druid.server.metrics.SubqueryCountStatsProvider;
import org.apache.druid.testing.InitializedNullHandlingTest;
import org.apache.druid.timeline.TimelineLookup;
import org.apache.druid.utils.JvmUtils;
+import org.hamcrest.MatcherAssert;
import org.hamcrest.core.IsInstanceOf;
import org.joda.time.Interval;
import org.junit.Assert;
@@ -303,11 +304,11 @@ public class MovingAverageQueryTest extends
InitializedNullHandlingTest
public void testQuery() throws IOException
{
Query<?> query = jsonMapper.readValue(getQueryString(), Query.class);
- Assert.assertThat(query, IsInstanceOf.instanceOf(getExpectedQueryType()));
+ MatcherAssert.assertThat(query,
IsInstanceOf.instanceOf(getExpectedQueryType()));
List<MapBasedRow> expectedResults =
jsonMapper.readValue(getExpectedResultString(), getExpectedResultType());
Assert.assertNotNull(expectedResults);
- Assert.assertThat(expectedResults, IsInstanceOf.instanceOf(List.class));
+ MatcherAssert.assertThat(expectedResults,
IsInstanceOf.instanceOf(List.class));
DruidHttpClientConfig httpClientConfig = new DruidHttpClientConfig()
{
diff --git
a/extensions-contrib/moving-average-query/src/test/java/org/apache/druid/query/movingaverage/averagers/DoubleMaxAveragerFactoryTest.java
b/extensions-contrib/moving-average-query/src/test/java/org/apache/druid/query/movingaverage/averagers/DoubleMaxAveragerFactoryTest.java
index ef8c8a76040..13a2c30aaa8 100644
---
a/extensions-contrib/moving-average-query/src/test/java/org/apache/druid/query/movingaverage/averagers/DoubleMaxAveragerFactoryTest.java
+++
b/extensions-contrib/moving-average-query/src/test/java/org/apache/druid/query/movingaverage/averagers/DoubleMaxAveragerFactoryTest.java
@@ -20,7 +20,7 @@
package org.apache.druid.query.movingaverage.averagers;
import org.hamcrest.CoreMatchers;
-import org.junit.Assert;
+import org.hamcrest.MatcherAssert;
import org.junit.Test;
public class DoubleMaxAveragerFactoryTest
@@ -29,6 +29,6 @@ public class DoubleMaxAveragerFactoryTest
public void testCreateAverager()
{
AveragerFactory<?, ?> fac = new DoubleMaxAveragerFactory("test", 5, 1,
"field");
- Assert.assertThat(fac.createAverager(),
CoreMatchers.instanceOf(DoubleMaxAverager.class));
+ MatcherAssert.assertThat(fac.createAverager(),
CoreMatchers.instanceOf(DoubleMaxAverager.class));
}
}
diff --git
a/extensions-contrib/moving-average-query/src/test/java/org/apache/druid/query/movingaverage/averagers/DoubleMeanAveragerFactoryTest.java
b/extensions-contrib/moving-average-query/src/test/java/org/apache/druid/query/movingaverage/averagers/DoubleMeanAveragerFactoryTest.java
index d4d85f44550..0a653c4c167 100644
---
a/extensions-contrib/moving-average-query/src/test/java/org/apache/druid/query/movingaverage/averagers/DoubleMeanAveragerFactoryTest.java
+++
b/extensions-contrib/moving-average-query/src/test/java/org/apache/druid/query/movingaverage/averagers/DoubleMeanAveragerFactoryTest.java
@@ -19,8 +19,8 @@
package org.apache.druid.query.movingaverage.averagers;
+import org.hamcrest.MatcherAssert;
import org.hamcrest.core.IsInstanceOf;
-import org.junit.Assert;
import org.junit.Test;
public class DoubleMeanAveragerFactoryTest
@@ -29,6 +29,6 @@ public class DoubleMeanAveragerFactoryTest
public void testCreateAverager()
{
AveragerFactory<?, ?> fac = new DoubleMeanAveragerFactory("test", 5, 1,
"field");
- Assert.assertThat(fac.createAverager(),
IsInstanceOf.instanceOf(DoubleMeanAverager.class));
+ MatcherAssert.assertThat(fac.createAverager(),
IsInstanceOf.instanceOf(DoubleMeanAverager.class));
}
}
diff --git
a/extensions-contrib/moving-average-query/src/test/java/org/apache/druid/query/movingaverage/averagers/DoubleMeanNoNullAveragerFactoryTest.java
b/extensions-contrib/moving-average-query/src/test/java/org/apache/druid/query/movingaverage/averagers/DoubleMeanNoNullAveragerFactoryTest.java
index 6afbd478b52..37b16ad58d4 100644
---
a/extensions-contrib/moving-average-query/src/test/java/org/apache/druid/query/movingaverage/averagers/DoubleMeanNoNullAveragerFactoryTest.java
+++
b/extensions-contrib/moving-average-query/src/test/java/org/apache/druid/query/movingaverage/averagers/DoubleMeanNoNullAveragerFactoryTest.java
@@ -19,8 +19,8 @@
package org.apache.druid.query.movingaverage.averagers;
+import org.hamcrest.MatcherAssert;
import org.hamcrest.core.IsInstanceOf;
-import org.junit.Assert;
import org.junit.Test;
public class DoubleMeanNoNullAveragerFactoryTest
@@ -29,6 +29,6 @@ public class DoubleMeanNoNullAveragerFactoryTest
public void testCreateAverager()
{
AveragerFactory<?, ?> fac = new DoubleMeanNoNullAveragerFactory("test", 5,
1, "field");
- Assert.assertThat(fac.createAverager(),
IsInstanceOf.instanceOf(DoubleMeanNoNullAverager.class));
+ MatcherAssert.assertThat(fac.createAverager(),
IsInstanceOf.instanceOf(DoubleMeanNoNullAverager.class));
}
}
diff --git
a/extensions-contrib/moving-average-query/src/test/java/org/apache/druid/query/movingaverage/averagers/DoubleMinAveragerFactoryTest.java
b/extensions-contrib/moving-average-query/src/test/java/org/apache/druid/query/movingaverage/averagers/DoubleMinAveragerFactoryTest.java
index 61250215afe..ee12ebc212a 100644
---
a/extensions-contrib/moving-average-query/src/test/java/org/apache/druid/query/movingaverage/averagers/DoubleMinAveragerFactoryTest.java
+++
b/extensions-contrib/moving-average-query/src/test/java/org/apache/druid/query/movingaverage/averagers/DoubleMinAveragerFactoryTest.java
@@ -19,8 +19,8 @@
package org.apache.druid.query.movingaverage.averagers;
+import org.hamcrest.MatcherAssert;
import org.hamcrest.core.IsInstanceOf;
-import org.junit.Assert;
import org.junit.Test;
public class DoubleMinAveragerFactoryTest
@@ -29,6 +29,6 @@ public class DoubleMinAveragerFactoryTest
public void testCreateAverager()
{
AveragerFactory<?, ?> fac = new DoubleMinAveragerFactory("test", 5, 1,
"field");
- Assert.assertThat(fac.createAverager(),
IsInstanceOf.instanceOf(DoubleMinAverager.class));
+ MatcherAssert.assertThat(fac.createAverager(),
IsInstanceOf.instanceOf(DoubleMinAverager.class));
}
}
diff --git
a/extensions-contrib/moving-average-query/src/test/java/org/apache/druid/query/movingaverage/averagers/DoubleSumAveragerFactoryTest.java
b/extensions-contrib/moving-average-query/src/test/java/org/apache/druid/query/movingaverage/averagers/DoubleSumAveragerFactoryTest.java
index bb65e963afa..de4956a278d 100644
---
a/extensions-contrib/moving-average-query/src/test/java/org/apache/druid/query/movingaverage/averagers/DoubleSumAveragerFactoryTest.java
+++
b/extensions-contrib/moving-average-query/src/test/java/org/apache/druid/query/movingaverage/averagers/DoubleSumAveragerFactoryTest.java
@@ -19,8 +19,8 @@
package org.apache.druid.query.movingaverage.averagers;
+import org.hamcrest.MatcherAssert;
import org.hamcrest.core.IsInstanceOf;
-import org.junit.Assert;
import org.junit.Test;
public class DoubleSumAveragerFactoryTest
@@ -30,7 +30,7 @@ public class DoubleSumAveragerFactoryTest
public void testCreateAverager()
{
AveragerFactory<?, ?> fac = new DoubleSumAveragerFactory("test", 5, 1,
"field");
- Assert.assertThat(fac.createAverager(),
IsInstanceOf.instanceOf(DoubleSumAverager.class));
+ MatcherAssert.assertThat(fac.createAverager(),
IsInstanceOf.instanceOf(DoubleSumAverager.class));
}
}
diff --git
a/extensions-contrib/moving-average-query/src/test/java/org/apache/druid/query/movingaverage/averagers/LongMaxAveragerFactoryTest.java
b/extensions-contrib/moving-average-query/src/test/java/org/apache/druid/query/movingaverage/averagers/LongMaxAveragerFactoryTest.java
index 0f429e787cf..d276e7be8ad 100644
---
a/extensions-contrib/moving-average-query/src/test/java/org/apache/druid/query/movingaverage/averagers/LongMaxAveragerFactoryTest.java
+++
b/extensions-contrib/moving-average-query/src/test/java/org/apache/druid/query/movingaverage/averagers/LongMaxAveragerFactoryTest.java
@@ -19,8 +19,8 @@
package org.apache.druid.query.movingaverage.averagers;
+import org.hamcrest.MatcherAssert;
import org.hamcrest.core.IsInstanceOf;
-import org.junit.Assert;
import org.junit.Test;
public class LongMaxAveragerFactoryTest
@@ -29,6 +29,6 @@ public class LongMaxAveragerFactoryTest
public void testCreateAverager()
{
AveragerFactory<?, ?> fac = new LongMaxAveragerFactory("test", 5, 1,
"field");
- Assert.assertThat(fac.createAverager(),
IsInstanceOf.instanceOf(LongMaxAverager.class));
+ MatcherAssert.assertThat(fac.createAverager(),
IsInstanceOf.instanceOf(LongMaxAverager.class));
}
}
diff --git
a/extensions-contrib/moving-average-query/src/test/java/org/apache/druid/query/movingaverage/averagers/LongMeanAveragerFactoryTest.java
b/extensions-contrib/moving-average-query/src/test/java/org/apache/druid/query/movingaverage/averagers/LongMeanAveragerFactoryTest.java
index 3b5b3e56be7..df5c96417f4 100644
---
a/extensions-contrib/moving-average-query/src/test/java/org/apache/druid/query/movingaverage/averagers/LongMeanAveragerFactoryTest.java
+++
b/extensions-contrib/moving-average-query/src/test/java/org/apache/druid/query/movingaverage/averagers/LongMeanAveragerFactoryTest.java
@@ -19,8 +19,8 @@
package org.apache.druid.query.movingaverage.averagers;
+import org.hamcrest.MatcherAssert;
import org.hamcrest.core.IsInstanceOf;
-import org.junit.Assert;
import org.junit.Test;
public class LongMeanAveragerFactoryTest
@@ -29,6 +29,6 @@ public class LongMeanAveragerFactoryTest
public void testCreateAverager()
{
AveragerFactory<?, ?> fac = new LongMeanAveragerFactory("test", 5, 1,
"field");
- Assert.assertThat(fac.createAverager(),
IsInstanceOf.instanceOf(LongMeanAverager.class));
+ MatcherAssert.assertThat(fac.createAverager(),
IsInstanceOf.instanceOf(LongMeanAverager.class));
}
}
diff --git
a/extensions-contrib/moving-average-query/src/test/java/org/apache/druid/query/movingaverage/averagers/LongMeanNoNullAveragerFactoryTest.java
b/extensions-contrib/moving-average-query/src/test/java/org/apache/druid/query/movingaverage/averagers/LongMeanNoNullAveragerFactoryTest.java
index fb3e33eaa5e..c691794777e 100644
---
a/extensions-contrib/moving-average-query/src/test/java/org/apache/druid/query/movingaverage/averagers/LongMeanNoNullAveragerFactoryTest.java
+++
b/extensions-contrib/moving-average-query/src/test/java/org/apache/druid/query/movingaverage/averagers/LongMeanNoNullAveragerFactoryTest.java
@@ -19,8 +19,8 @@
package org.apache.druid.query.movingaverage.averagers;
+import org.hamcrest.MatcherAssert;
import org.hamcrest.core.IsInstanceOf;
-import org.junit.Assert;
import org.junit.Test;
public class LongMeanNoNullAveragerFactoryTest
@@ -29,6 +29,6 @@ public class LongMeanNoNullAveragerFactoryTest
public void testCreateAverager()
{
AveragerFactory<?, ?> fac = new LongMeanNoNullAveragerFactory("test", 5,
1, "field");
- Assert.assertThat(fac.createAverager(),
IsInstanceOf.instanceOf(LongMeanNoNullAverager.class));
+ MatcherAssert.assertThat(fac.createAverager(),
IsInstanceOf.instanceOf(LongMeanNoNullAverager.class));
}
}
diff --git
a/extensions-contrib/moving-average-query/src/test/java/org/apache/druid/query/movingaverage/averagers/LongMinAveragerFactoryTest.java
b/extensions-contrib/moving-average-query/src/test/java/org/apache/druid/query/movingaverage/averagers/LongMinAveragerFactoryTest.java
index 9dca156bc63..8e5b89a0d17 100644
---
a/extensions-contrib/moving-average-query/src/test/java/org/apache/druid/query/movingaverage/averagers/LongMinAveragerFactoryTest.java
+++
b/extensions-contrib/moving-average-query/src/test/java/org/apache/druid/query/movingaverage/averagers/LongMinAveragerFactoryTest.java
@@ -19,8 +19,8 @@
package org.apache.druid.query.movingaverage.averagers;
+import org.hamcrest.MatcherAssert;
import org.hamcrest.core.IsInstanceOf;
-import org.junit.Assert;
import org.junit.Test;
public class LongMinAveragerFactoryTest
@@ -29,6 +29,6 @@ public class LongMinAveragerFactoryTest
public void testCreateAverager()
{
AveragerFactory<?, ?> fac = new LongMinAveragerFactory("test", 5, 1,
"field");
- Assert.assertThat(fac.createAverager(),
IsInstanceOf.instanceOf(LongMinAverager.class));
+ MatcherAssert.assertThat(fac.createAverager(),
IsInstanceOf.instanceOf(LongMinAverager.class));
}
}
diff --git
a/extensions-contrib/moving-average-query/src/test/java/org/apache/druid/query/movingaverage/averagers/LongSumAveragerFactoryTest.java
b/extensions-contrib/moving-average-query/src/test/java/org/apache/druid/query/movingaverage/averagers/LongSumAveragerFactoryTest.java
index fb297adf8c5..2bf0d12faa5 100644
---
a/extensions-contrib/moving-average-query/src/test/java/org/apache/druid/query/movingaverage/averagers/LongSumAveragerFactoryTest.java
+++
b/extensions-contrib/moving-average-query/src/test/java/org/apache/druid/query/movingaverage/averagers/LongSumAveragerFactoryTest.java
@@ -19,8 +19,8 @@
package org.apache.druid.query.movingaverage.averagers;
+import org.hamcrest.MatcherAssert;
import org.hamcrest.core.IsInstanceOf;
-import org.junit.Assert;
import org.junit.Test;
public class LongSumAveragerFactoryTest
@@ -30,7 +30,7 @@ public class LongSumAveragerFactoryTest
public void testCreateAverager()
{
AveragerFactory<?, ?> fac = new LongSumAveragerFactory("test", 5, 1,
"field");
- Assert.assertThat(fac.createAverager(),
IsInstanceOf.instanceOf(LongSumAverager.class));
+ MatcherAssert.assertThat(fac.createAverager(),
IsInstanceOf.instanceOf(LongSumAverager.class));
}
}
diff --git
a/extensions-core/datasketches/src/test/java/org/apache/druid/query/aggregation/datasketches/util/ToObjectVectorColumnProcessorFactoryTest.java
b/extensions-core/datasketches/src/test/java/org/apache/druid/query/aggregation/datasketches/util/ToObjectVectorColumnProcessorFactoryTest.java
index 2fea6774e89..393dd3fd66a 100644
---
a/extensions-core/datasketches/src/test/java/org/apache/druid/query/aggregation/datasketches/util/ToObjectVectorColumnProcessorFactoryTest.java
+++
b/extensions-core/datasketches/src/test/java/org/apache/druid/query/aggregation/datasketches/util/ToObjectVectorColumnProcessorFactoryTest.java
@@ -34,6 +34,7 @@ import org.apache.druid.segment.TestIndex;
import org.apache.druid.segment.vector.VectorCursor;
import org.apache.druid.testing.InitializedNullHandlingTest;
import org.hamcrest.CoreMatchers;
+import org.hamcrest.MatcherAssert;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
@@ -168,7 +169,7 @@ public class ToObjectVectorColumnProcessorFactoryTest
extends InitializedNullHan
public void testComplexSketch()
{
final Object sketch =
Iterables.getOnlyElement(readColumn("quality_uniques", 1));
- Assert.assertThat(sketch,
CoreMatchers.instanceOf(HyperLogLogCollector.class));
+ MatcherAssert.assertThat(sketch,
CoreMatchers.instanceOf(HyperLogLogCollector.class));
}
private CursorHolder makeCursorHolder()
diff --git
a/extensions-core/histogram/src/test/java/org/apache/druid/query/aggregation/histogram/QuantilesTest.java
b/extensions-core/histogram/src/test/java/org/apache/druid/query/aggregation/histogram/QuantilesTest.java
index c299d553d87..378cc3271e3 100644
---
a/extensions-core/histogram/src/test/java/org/apache/druid/query/aggregation/histogram/QuantilesTest.java
+++
b/extensions-core/histogram/src/test/java/org/apache/druid/query/aggregation/histogram/QuantilesTest.java
@@ -23,6 +23,7 @@ import com.fasterxml.jackson.databind.ObjectMapper;
import nl.jqno.equalsverifier.EqualsVerifier;
import org.apache.druid.jackson.DefaultObjectMapper;
import org.hamcrest.CoreMatchers;
+import org.hamcrest.MatcherAssert;
import org.junit.Assert;
import org.junit.Test;
@@ -46,7 +47,7 @@ public class QuantilesTest
);
Object theObject = mapper.readValue(theString, Object.class);
- Assert.assertThat(theObject, CoreMatchers.instanceOf(LinkedHashMap.class));
+ MatcherAssert.assertThat(theObject,
CoreMatchers.instanceOf(LinkedHashMap.class));
LinkedHashMap theMap = (LinkedHashMap) theObject;
diff --git
a/indexing-service/src/test/java/org/apache/druid/indexing/common/task/batch/parallel/ParallelIndexSupervisorTaskTest.java
b/indexing-service/src/test/java/org/apache/druid/indexing/common/task/batch/parallel/ParallelIndexSupervisorTaskTest.java
index 19dc225b6c9..de2983e0f39 100644
---
a/indexing-service/src/test/java/org/apache/druid/indexing/common/task/batch/parallel/ParallelIndexSupervisorTaskTest.java
+++
b/indexing-service/src/test/java/org/apache/druid/indexing/common/task/batch/parallel/ParallelIndexSupervisorTaskTest.java
@@ -136,7 +136,7 @@ public class ParallelIndexSupervisorTaskTest
int maxPartitionSize =
sortedPartitionSizes.get(sortedPartitionSizes.size() - 1);
int partitionSizeRange = maxPartitionSize - minPartitionSize;
- Assert.assertThat(
+ MatcherAssert.assertThat(
"partition sizes = " + actualPartitionSizes,
partitionSizeRange,
Matchers.is(Matchers.both(Matchers.greaterThanOrEqualTo(0)).and(Matchers.lessThanOrEqualTo(1)))
diff --git
a/indexing-service/src/test/java/org/apache/druid/indexing/common/task/batch/parallel/PartialHashSegmentGenerateTaskTest.java
b/indexing-service/src/test/java/org/apache/druid/indexing/common/task/batch/parallel/PartialHashSegmentGenerateTaskTest.java
index f5b9e952df2..af30f3b0d56 100644
---
a/indexing-service/src/test/java/org/apache/druid/indexing/common/task/batch/parallel/PartialHashSegmentGenerateTaskTest.java
+++
b/indexing-service/src/test/java/org/apache/druid/indexing/common/task/batch/parallel/PartialHashSegmentGenerateTaskTest.java
@@ -35,6 +35,7 @@ import org.apache.druid.server.security.Action;
import org.apache.druid.server.security.Resource;
import org.apache.druid.server.security.ResourceAction;
import org.apache.druid.server.security.ResourceType;
+import org.hamcrest.MatcherAssert;
import org.hamcrest.Matchers;
import org.joda.time.Interval;
import org.junit.Assert;
@@ -92,7 +93,7 @@ public class PartialHashSegmentGenerateTaskTest
public void hasCorrectPrefixForAutomaticId()
{
String id = target.getId();
- Assert.assertThat(id,
Matchers.startsWith(PartialHashSegmentGenerateTask.TYPE));
+ MatcherAssert.assertThat(id,
Matchers.startsWith(PartialHashSegmentGenerateTask.TYPE));
}
@Test
diff --git
a/indexing-service/src/test/java/org/apache/druid/indexing/common/task/batch/parallel/RangePartitionMultiPhaseParallelIndexingTest.java
b/indexing-service/src/test/java/org/apache/druid/indexing/common/task/batch/parallel/RangePartitionMultiPhaseParallelIndexingTest.java
index cc3abacba0a..119d7b527a6 100644
---
a/indexing-service/src/test/java/org/apache/druid/indexing/common/task/batch/parallel/RangePartitionMultiPhaseParallelIndexingTest.java
+++
b/indexing-service/src/test/java/org/apache/druid/indexing/common/task/batch/parallel/RangePartitionMultiPhaseParallelIndexingTest.java
@@ -43,6 +43,7 @@ import org.apache.druid.timeline.DataSegment;
import org.apache.druid.timeline.partition.DimensionRangeShardSpec;
import org.apache.druid.timeline.partition.NumberedShardSpec;
import org.apache.druid.timeline.partition.SingleDimensionShardSpec;
+import org.hamcrest.MatcherAssert;
import org.hamcrest.Matchers;
import org.joda.time.Interval;
import org.junit.Assert;
@@ -455,14 +456,14 @@ public class RangePartitionMultiPhaseParallelIndexingTest
extends AbstractMultiP
for (StringTuple value : values) {
if (start != null) {
- Assert.assertThat(value.compareTo(start),
Matchers.greaterThanOrEqualTo(0));
+ MatcherAssert.assertThat(value.compareTo(start),
Matchers.greaterThanOrEqualTo(0));
}
if (end != null) {
if (value == null) {
Assert.assertNull("null values should be in first partition", start);
} else {
- Assert.assertThat(value.compareTo(end), Matchers.lessThan(0));
+ MatcherAssert.assertThat(value.compareTo(end), Matchers.lessThan(0));
}
}
}
diff --git
a/indexing-service/src/test/java/org/apache/druid/indexing/common/task/batch/parallel/distribution/StringSketchTest.java
b/indexing-service/src/test/java/org/apache/druid/indexing/common/task/batch/parallel/distribution/StringSketchTest.java
index c37b805c70b..76be90220bc 100644
---
a/indexing-service/src/test/java/org/apache/druid/indexing/common/task/batch/parallel/distribution/StringSketchTest.java
+++
b/indexing-service/src/test/java/org/apache/druid/indexing/common/task/batch/parallel/distribution/StringSketchTest.java
@@ -27,6 +27,7 @@ import org.apache.druid.jackson.JacksonModule;
import org.apache.druid.java.util.common.StringUtils;
import org.apache.druid.segment.TestHelper;
import org.apache.druid.timeline.partition.PartitionBoundaries;
+import org.hamcrest.MatcherAssert;
import org.hamcrest.Matchers;
import org.hamcrest.number.IsCloseTo;
import org.junit.Assert;
@@ -208,12 +209,12 @@ public class StringSketchTest
String partitionBoundariesString =
PartitionTest.toString(partitionBoundaries);
int expectedHighPartitionBoundaryCount = (int) Math.ceil((double)
NUM_STRING / targetSize);
int expectedLowPartitionBoundaryCount =
expectedHighPartitionBoundaryCount - 1;
- Assert.assertThat(
+ MatcherAssert.assertThat(
"targetSize=" + targetSize + " " + partitionBoundariesString,
partitionBoundaries.size(),
Matchers.lessThanOrEqualTo(expectedHighPartitionBoundaryCount + 1)
);
- Assert.assertThat(
+ MatcherAssert.assertThat(
"targetSize=" + targetSize + " " + partitionBoundariesString,
partitionBoundaries.size(),
Matchers.greaterThanOrEqualTo(expectedLowPartitionBoundaryCount +
1)
@@ -223,7 +224,7 @@ public class StringSketchTest
for (int i = 1; i < partitionBoundaries.size() - 1; i++) {
int current = Integer.parseInt(partitionBoundaries.get(i).get(0));
int size = current - previous;
- Assert.assertThat(
+ MatcherAssert.assertThat(
getErrMsgPrefix(targetSize, i) + partitionBoundariesString,
(double) size,
IsCloseTo.closeTo(targetSize, Math.ceil(DELTA) * 2)
@@ -314,12 +315,12 @@ public class StringSketchTest
for (int i = 1; i < partitionBoundaries.size() - 1; i++) {
int current = Integer.parseInt(partitionBoundaries.get(i).get(0));
int size = current - previous;
- Assert.assertThat(
+ MatcherAssert.assertThat(
getErrMsgPrefix(maxSize, i) + partitionBoundariesString,
size,
Matchers.lessThanOrEqualTo(maxSize)
);
- Assert.assertThat(
+ MatcherAssert.assertThat(
getErrMsgPrefix(maxSize, i) + partitionBoundariesString,
(double) size,
Matchers.greaterThanOrEqualTo(minSize)
diff --git
a/indexing-service/src/test/java/org/apache/druid/indexing/common/task/batch/parallel/iterator/RangePartitionIndexTaskInputRowIteratorBuilderTest.java
b/indexing-service/src/test/java/org/apache/druid/indexing/common/task/batch/parallel/iterator/RangePartitionIndexTaskInputRowIteratorBuilderTest.java
index f933f5b3c38..ccc3e5f3305 100644
---
a/indexing-service/src/test/java/org/apache/druid/indexing/common/task/batch/parallel/iterator/RangePartitionIndexTaskInputRowIteratorBuilderTest.java
+++
b/indexing-service/src/test/java/org/apache/druid/indexing/common/task/batch/parallel/iterator/RangePartitionIndexTaskInputRowIteratorBuilderTest.java
@@ -22,6 +22,7 @@ package
org.apache.druid.indexing.common.task.batch.parallel.iterator;
import org.apache.druid.data.input.InputRow;
import org.apache.druid.indexer.granularity.GranularitySpec;
import org.apache.druid.java.util.common.parsers.CloseableIterator;
+import org.hamcrest.MatcherAssert;
import org.hamcrest.Matchers;
import org.joda.time.DateTime;
import org.junit.Assert;
@@ -200,6 +201,6 @@ public class
RangePartitionIndexTaskInputRowIteratorBuilderTest
IndexTaskInputRowIteratorBuilderTestingFactory.HandlerTester.Handler
handler
)
{
- Assert.assertThat(handlerInvocationHistory,
Matchers.not(Matchers.contains(handler)));
+ MatcherAssert.assertThat(handlerInvocationHistory,
Matchers.not(Matchers.contains(handler)));
}
}
diff --git
a/indexing-service/src/test/java/org/apache/druid/indexing/input/DruidInputSourceTest.java
b/indexing-service/src/test/java/org/apache/druid/indexing/input/DruidInputSourceTest.java
index 5e4ecd657cd..35f819bfe6a 100644
---
a/indexing-service/src/test/java/org/apache/druid/indexing/input/DruidInputSourceTest.java
+++
b/indexing-service/src/test/java/org/apache/druid/indexing/input/DruidInputSourceTest.java
@@ -39,6 +39,7 @@ import org.apache.druid.segment.IndexIO;
import org.apache.druid.segment.TestHelper;
import org.easymock.EasyMock;
import org.hamcrest.CoreMatchers;
+import org.hamcrest.MatcherAssert;
import org.joda.time.Interval;
import org.junit.Assert;
import org.junit.Before;
@@ -86,7 +87,7 @@ public class DruidInputSourceTest
final InputSource inputSource = mapper.readValue(json, InputSource.class);
- Assert.assertThat(inputSource,
CoreMatchers.instanceOf(DruidInputSource.class));
+ MatcherAssert.assertThat(inputSource,
CoreMatchers.instanceOf(DruidInputSource.class));
Assert.assertEquals(
new DruidInputSource(
"foo",
@@ -119,7 +120,7 @@ public class DruidInputSourceTest
final InputSource inputSource = mapper.readValue(json, InputSource.class);
- Assert.assertThat(inputSource,
CoreMatchers.instanceOf(DruidInputSource.class));
+ MatcherAssert.assertThat(inputSource,
CoreMatchers.instanceOf(DruidInputSource.class));
Assert.assertEquals(
new DruidInputSource(
"foo",
@@ -153,7 +154,7 @@ public class DruidInputSourceTest
final InputSource inputSource = mapper.readValue(json, InputSource.class);
- Assert.assertThat(inputSource,
CoreMatchers.instanceOf(DruidInputSource.class));
+ MatcherAssert.assertThat(inputSource,
CoreMatchers.instanceOf(DruidInputSource.class));
Assert.assertEquals(
new DruidInputSource(
"foo",
diff --git
a/indexing-service/src/test/java/org/apache/druid/indexing/overlord/SingleTaskBackgroundRunnerTest.java
b/indexing-service/src/test/java/org/apache/druid/indexing/overlord/SingleTaskBackgroundRunnerTest.java
index b628f8a253c..78519fe3302 100644
---
a/indexing-service/src/test/java/org/apache/druid/indexing/overlord/SingleTaskBackgroundRunnerTest.java
+++
b/indexing-service/src/test/java/org/apache/druid/indexing/overlord/SingleTaskBackgroundRunnerTest.java
@@ -64,6 +64,7 @@ import org.apache.druid.server.security.AuthTestUtils;
import org.apache.druid.utils.JvmUtils;
import org.easymock.EasyMock;
import org.hamcrest.CoreMatchers;
+import org.hamcrest.MatcherAssert;
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
@@ -181,7 +182,7 @@ public class SingleTaskBackgroundRunnerTest
.build()
.getRunner(runner);
- Assert.assertThat(queryRunner,
CoreMatchers.instanceOf(SetAndVerifyContextQueryRunner.class));
+ MatcherAssert.assertThat(queryRunner,
CoreMatchers.instanceOf(SetAndVerifyContextQueryRunner.class));
}
@Test
diff --git
a/processing/src/test/java/org/apache/druid/segment/join/HashJoinSegmentTest.java
b/processing/src/test/java/org/apache/druid/segment/join/HashJoinSegmentTest.java
index bf4de04f7e0..b39e999f7c3 100644
---
a/processing/src/test/java/org/apache/druid/segment/join/HashJoinSegmentTest.java
+++
b/processing/src/test/java/org/apache/druid/segment/join/HashJoinSegmentTest.java
@@ -40,6 +40,7 @@ import
org.apache.druid.segment.join.table.IndexedTableJoinable;
import org.apache.druid.testing.InitializedNullHandlingTest;
import org.apache.druid.timeline.SegmentId;
import org.hamcrest.CoreMatchers;
+import org.hamcrest.MatcherAssert;
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
@@ -248,7 +249,7 @@ public class HashJoinSegmentTest extends
InitializedNullHandlingTest
@Test
public void test_asCursorFactory()
{
- Assert.assertThat(
+ MatcherAssert.assertThat(
makeJoinSegment().as(CursorFactory.class),
CoreMatchers.instanceOf(HashJoinSegmentCursorFactory.class)
);
diff --git
a/processing/src/test/java/org/apache/druid/utils/CloseableUtilsTest.java
b/processing/src/test/java/org/apache/druid/utils/CloseableUtilsTest.java
index 68d37f80205..40c2732c7f6 100644
--- a/processing/src/test/java/org/apache/druid/utils/CloseableUtilsTest.java
+++ b/processing/src/test/java/org/apache/druid/utils/CloseableUtilsTest.java
@@ -21,6 +21,7 @@ package org.apache.druid.utils;
import com.google.common.base.Throwables;
import org.hamcrest.CoreMatchers;
+import org.hamcrest.MatcherAssert;
import org.junit.Assert;
import org.junit.Test;
import org.junit.internal.matchers.ThrowableCauseMatcher;
@@ -75,11 +76,11 @@ public class CloseableUtilsTest
assertClosed(quietCloseable, ioExceptionCloseable, quietCloseable2,
runtimeExceptionCloseable);
// First exception
- Assert.assertThat(e, CoreMatchers.instanceOf(IOException.class));
+ MatcherAssert.assertThat(e, CoreMatchers.instanceOf(IOException.class));
// Second exception
Assert.assertEquals(1, e.getSuppressed().length);
- Assert.assertThat(e.getSuppressed()[0],
CoreMatchers.instanceOf(IllegalArgumentException.class));
+ MatcherAssert.assertThat(e.getSuppressed()[0],
CoreMatchers.instanceOf(IllegalArgumentException.class));
}
@Test
@@ -104,11 +105,11 @@ public class CloseableUtilsTest
assertClosed(quietCloseable, ioExceptionCloseable, quietCloseable2,
runtimeExceptionCloseable);
// First exception
- Assert.assertThat(e, CoreMatchers.instanceOf(IOException.class));
+ MatcherAssert.assertThat(e, CoreMatchers.instanceOf(IOException.class));
// Second exception
Assert.assertEquals(1, e.getSuppressed().length);
- Assert.assertThat(e.getSuppressed()[0],
CoreMatchers.instanceOf(IllegalArgumentException.class));
+ MatcherAssert.assertThat(e.getSuppressed()[0],
CoreMatchers.instanceOf(IllegalArgumentException.class));
}
@Test
@@ -137,7 +138,7 @@ public class CloseableUtilsTest
}
assertClosed(ioExceptionCloseable);
- Assert.assertThat(e, CoreMatchers.instanceOf(RuntimeException.class));
+ MatcherAssert.assertThat(e,
CoreMatchers.instanceOf(RuntimeException.class));
}
@Test
@@ -152,7 +153,7 @@ public class CloseableUtilsTest
}
assertClosed(runtimeExceptionCloseable);
- Assert.assertThat(e,
CoreMatchers.instanceOf(IllegalArgumentException.class));
+ MatcherAssert.assertThat(e,
CoreMatchers.instanceOf(IllegalArgumentException.class));
}
@Test
@@ -167,7 +168,7 @@ public class CloseableUtilsTest
}
assertClosed(assertionErrorCloseable);
- Assert.assertThat(e, CoreMatchers.instanceOf(AssertionError.class));
+ MatcherAssert.assertThat(e, CoreMatchers.instanceOf(AssertionError.class));
}
@Test
@@ -223,8 +224,8 @@ public class CloseableUtilsTest
Assert.assertTrue(quietCloseable.isClosed());
- Assert.assertThat(e, CoreMatchers.instanceOf(IllegalStateException.class));
- Assert.assertThat(
+ MatcherAssert.assertThat(e,
CoreMatchers.instanceOf(IllegalStateException.class));
+ MatcherAssert.assertThat(
e,
ThrowableMessageMatcher.hasMessage(CoreMatchers.startsWith("Must be
called with non-null caught exception"))
);
@@ -244,8 +245,8 @@ public class CloseableUtilsTest
Assert.assertTrue(quietCloseable.isClosed());
- Assert.assertThat(e, CoreMatchers.instanceOf(RuntimeException.class));
- Assert.assertThat(
+ MatcherAssert.assertThat(e,
CoreMatchers.instanceOf(RuntimeException.class));
+ MatcherAssert.assertThat(
e,
ThrowableMessageMatcher.hasMessage(CoreMatchers.startsWith("this one
was caught"))
);
@@ -266,15 +267,15 @@ public class CloseableUtilsTest
Assert.assertTrue(ioExceptionCloseable.isClosed());
// First exception
- Assert.assertThat(e, CoreMatchers.instanceOf(IOException.class));
- Assert.assertThat(
+ MatcherAssert.assertThat(e, CoreMatchers.instanceOf(IOException.class));
+ MatcherAssert.assertThat(
e,
ThrowableMessageMatcher.hasMessage(CoreMatchers.startsWith("this one
was caught"))
);
// Second exception
Assert.assertEquals(1, e.getSuppressed().length);
- Assert.assertThat(e.getSuppressed()[0],
CoreMatchers.instanceOf(IOException.class));
+ MatcherAssert.assertThat(e.getSuppressed()[0],
CoreMatchers.instanceOf(IOException.class));
}
@Test
@@ -292,15 +293,15 @@ public class CloseableUtilsTest
Assert.assertTrue(runtimeExceptionCloseable.isClosed());
// First exception
- Assert.assertThat(e, CoreMatchers.instanceOf(RuntimeException.class));
- Assert.assertThat(
+ MatcherAssert.assertThat(e,
CoreMatchers.instanceOf(RuntimeException.class));
+ MatcherAssert.assertThat(
e,
ThrowableMessageMatcher.hasMessage(CoreMatchers.startsWith("this one
was caught"))
);
// Second exception
Assert.assertEquals(1, e.getSuppressed().length);
- Assert.assertThat(e.getSuppressed()[0],
CoreMatchers.instanceOf(IllegalArgumentException.class));
+ MatcherAssert.assertThat(e.getSuppressed()[0],
CoreMatchers.instanceOf(IllegalArgumentException.class));
}
@Test
@@ -317,8 +318,8 @@ public class CloseableUtilsTest
Assert.assertTrue(quietCloseable.isClosed());
- Assert.assertThat(e, CoreMatchers.instanceOf(IllegalStateException.class));
- Assert.assertThat(
+ MatcherAssert.assertThat(e,
CoreMatchers.instanceOf(IllegalStateException.class));
+ MatcherAssert.assertThat(
e,
ThrowableMessageMatcher.hasMessage(CoreMatchers.startsWith("Must be
called with non-null caught exception"))
);
@@ -338,8 +339,8 @@ public class CloseableUtilsTest
Assert.assertTrue(quietCloseable.isClosed());
- Assert.assertThat(e, CoreMatchers.instanceOf(RuntimeException.class));
- Assert.assertThat(
+ MatcherAssert.assertThat(e,
CoreMatchers.instanceOf(RuntimeException.class));
+ MatcherAssert.assertThat(
e,
ThrowableMessageMatcher.hasMessage(CoreMatchers.startsWith("this one
was caught"))
);
@@ -360,13 +361,13 @@ public class CloseableUtilsTest
Assert.assertTrue(ioExceptionCloseable.isClosed());
// First exception
- Assert.assertThat(e, CoreMatchers.instanceOf(RuntimeException.class));
- Assert.assertThat(
+ MatcherAssert.assertThat(e,
CoreMatchers.instanceOf(RuntimeException.class));
+ MatcherAssert.assertThat(
e,
ThrowableMessageMatcher.hasMessage(CoreMatchers.startsWith("java.io.IOException:
this one was caught"))
);
- Assert.assertThat(e,
ThrowableCauseMatcher.hasCause(CoreMatchers.instanceOf(IOException.class)));
- Assert.assertThat(
+ MatcherAssert.assertThat(e,
ThrowableCauseMatcher.hasCause(CoreMatchers.instanceOf(IOException.class)));
+ MatcherAssert.assertThat(
e,
ThrowableCauseMatcher.hasCause(
ThrowableMessageMatcher.hasMessage(CoreMatchers.startsWith("this
one was caught"))
@@ -375,7 +376,7 @@ public class CloseableUtilsTest
// Second exception
Assert.assertEquals(1, e.getCause().getSuppressed().length);
- Assert.assertThat(e.getCause().getSuppressed()[0],
CoreMatchers.instanceOf(IOException.class));
+ MatcherAssert.assertThat(e.getCause().getSuppressed()[0],
CoreMatchers.instanceOf(IOException.class));
}
@Test
@@ -393,15 +394,15 @@ public class CloseableUtilsTest
Assert.assertTrue(runtimeExceptionCloseable.isClosed());
// First exception
- Assert.assertThat(e, CoreMatchers.instanceOf(RuntimeException.class));
- Assert.assertThat(
+ MatcherAssert.assertThat(e,
CoreMatchers.instanceOf(RuntimeException.class));
+ MatcherAssert.assertThat(
e,
ThrowableMessageMatcher.hasMessage(CoreMatchers.startsWith("this one
was caught"))
);
// Second exception
Assert.assertEquals(1, e.getSuppressed().length);
- Assert.assertThat(e.getSuppressed()[0],
CoreMatchers.instanceOf(IllegalArgumentException.class));
+ MatcherAssert.assertThat(e.getSuppressed()[0],
CoreMatchers.instanceOf(IllegalArgumentException.class));
}
@Test
@@ -419,15 +420,15 @@ public class CloseableUtilsTest
Assert.assertTrue(assertionErrorCloseable.isClosed());
// First exception
- Assert.assertThat(e, CoreMatchers.instanceOf(RuntimeException.class));
- Assert.assertThat(
+ MatcherAssert.assertThat(e,
CoreMatchers.instanceOf(RuntimeException.class));
+ MatcherAssert.assertThat(
e,
ThrowableMessageMatcher.hasMessage(CoreMatchers.startsWith("this one
was caught"))
);
// Second exception
Assert.assertEquals(1, e.getSuppressed().length);
- Assert.assertThat(e.getSuppressed()[0],
CoreMatchers.instanceOf(AssertionError.class));
+ MatcherAssert.assertThat(e.getSuppressed()[0],
CoreMatchers.instanceOf(AssertionError.class));
}
@Test
diff --git
a/server/src/test/java/org/apache/druid/curator/CuratorModuleTest.java
b/server/src/test/java/org/apache/druid/curator/CuratorModuleTest.java
index 8708bbae25d..03939f38e0a 100644
--- a/server/src/test/java/org/apache/druid/curator/CuratorModuleTest.java
+++ b/server/src/test/java/org/apache/druid/curator/CuratorModuleTest.java
@@ -135,7 +135,7 @@ public final class CuratorModuleTest
{
CuratorFramework curatorFramework =
injector.getInstance(CuratorFramework.class);
RetryPolicy retryPolicy =
curatorFramework.getZookeeperClient().getRetryPolicy();
- Assert.assertThat(retryPolicy,
CoreMatchers.instanceOf(ExponentialBackoffRetry.class));
+ MatcherAssert.assertThat(retryPolicy,
CoreMatchers.instanceOf(ExponentialBackoffRetry.class));
RetryPolicy adjustedRetryPolicy =
adjustRetryPolicy((BoundedExponentialBackoffRetry) retryPolicy, maxRetries);
curatorFramework.getZookeeperClient().setRetryPolicy(adjustedRetryPolicy);
return curatorFramework;
diff --git
a/server/src/test/java/org/apache/druid/segment/InlineSegmentWranglerTest.java
b/server/src/test/java/org/apache/druid/segment/InlineSegmentWranglerTest.java
index 80bd3eb2eb3..3e2ad02c9d6 100644
---
a/server/src/test/java/org/apache/druid/segment/InlineSegmentWranglerTest.java
+++
b/server/src/test/java/org/apache/druid/segment/InlineSegmentWranglerTest.java
@@ -27,6 +27,7 @@ import org.apache.druid.query.TableDataSource;
import org.apache.druid.segment.column.ColumnType;
import org.apache.druid.segment.column.RowSignature;
import org.hamcrest.CoreMatchers;
+import org.hamcrest.MatcherAssert;
import org.junit.Assert;
import org.junit.Rule;
import org.junit.Test;
@@ -74,6 +75,6 @@ public class InlineSegmentWranglerTest
Assert.assertEquals(1, segments.size());
final Segment segment = Iterables.getOnlyElement(segments);
- Assert.assertThat(segment, CoreMatchers.instanceOf(RowBasedSegment.class));
+ MatcherAssert.assertThat(segment,
CoreMatchers.instanceOf(RowBasedSegment.class));
}
}
diff --git
a/server/src/test/java/org/apache/druid/segment/LookupSegmentWranglerTest.java
b/server/src/test/java/org/apache/druid/segment/LookupSegmentWranglerTest.java
index 9d8e2653cef..270700181b4 100644
---
a/server/src/test/java/org/apache/druid/segment/LookupSegmentWranglerTest.java
+++
b/server/src/test/java/org/apache/druid/segment/LookupSegmentWranglerTest.java
@@ -30,6 +30,7 @@ import
org.apache.druid.query.lookup.LookupExtractorFactoryContainerProvider;
import org.apache.druid.query.lookup.LookupSegment;
import org.apache.druid.query.lookup.LookupSegmentTest;
import org.hamcrest.CoreMatchers;
+import org.hamcrest.MatcherAssert;
import org.junit.Assert;
import org.junit.Rule;
import org.junit.Test;
@@ -99,7 +100,7 @@ public class LookupSegmentWranglerTest
);
Assert.assertEquals(1, segments.size());
- Assert.assertThat(Iterables.getOnlyElement(segments),
CoreMatchers.instanceOf(LookupSegment.class));
+ MatcherAssert.assertThat(Iterables.getOnlyElement(segments),
CoreMatchers.instanceOf(LookupSegment.class));
}
@Test
diff --git
a/server/src/test/java/org/apache/druid/segment/join/LookupJoinableFactoryTest.java
b/server/src/test/java/org/apache/druid/segment/join/LookupJoinableFactoryTest.java
index 160cf74f965..4abc496c81a 100644
---
a/server/src/test/java/org/apache/druid/segment/join/LookupJoinableFactoryTest.java
+++
b/server/src/test/java/org/apache/druid/segment/join/LookupJoinableFactoryTest.java
@@ -30,6 +30,7 @@ import
org.apache.druid.query.lookup.LookupExtractorFactoryContainerProvider;
import org.apache.druid.query.lookup.MapLookupExtractorFactory;
import org.apache.druid.segment.join.lookup.LookupJoinable;
import org.hamcrest.CoreMatchers;
+import org.hamcrest.MatcherAssert;
import org.junit.Assert;
import org.junit.Rule;
import org.junit.Test;
@@ -125,7 +126,7 @@ public class LookupJoinableFactoryTest
{
final Joinable joinable = factory.build(lookupDataSource, makeCondition("x
== \"j.k\"")).get();
- Assert.assertThat(joinable, CoreMatchers.instanceOf(LookupJoinable.class));
+ MatcherAssert.assertThat(joinable,
CoreMatchers.instanceOf(LookupJoinable.class));
Assert.assertEquals(ImmutableList.of("k", "v"),
joinable.getAvailableColumns());
Assert.assertEquals(Joinable.CARDINALITY_UNKNOWN,
joinable.getCardinality("k"));
Assert.assertEquals(Joinable.CARDINALITY_UNKNOWN,
joinable.getCardinality("v"));
diff --git
a/server/src/test/java/org/apache/druid/server/emitter/EmitterModuleTest.java
b/server/src/test/java/org/apache/druid/server/emitter/EmitterModuleTest.java
index 7e7d0e60d1b..5fbd1d938e8 100644
---
a/server/src/test/java/org/apache/druid/server/emitter/EmitterModuleTest.java
+++
b/server/src/test/java/org/apache/druid/server/emitter/EmitterModuleTest.java
@@ -54,6 +54,7 @@ import org.apache.druid.server.metrics.DefaultLoadSpecHolder;
import org.apache.druid.server.metrics.LoadSpecHolder;
import org.apache.druid.server.metrics.TestTaskHolder;
import org.hamcrest.CoreMatchers;
+import org.hamcrest.MatcherAssert;
import org.junit.Assert;
import org.junit.Rule;
import org.junit.Test;
@@ -85,7 +86,7 @@ public class EmitterModuleTest
final Emitter emitter =
makeInjectorWithProperties(props).getInstance(Emitter.class);
// Testing that ParametrizedUriEmitter is successfully deserialized from
the above config
- Assert.assertThat(emitter,
CoreMatchers.instanceOf(ParametrizedUriEmitter.class));
+ MatcherAssert.assertThat(emitter,
CoreMatchers.instanceOf(ParametrizedUriEmitter.class));
}
@Test
@@ -95,7 +96,7 @@ public class EmitterModuleTest
props.setProperty("druid.emitter", "");
final Emitter emitter =
makeInjectorWithProperties(props).getInstance(Emitter.class);
- Assert.assertThat(emitter, CoreMatchers.instanceOf(NoopEmitter.class));
+ MatcherAssert.assertThat(emitter,
CoreMatchers.instanceOf(NoopEmitter.class));
}
@Test
diff --git
a/server/src/test/java/org/apache/druid/server/log/LoggingRequestLoggerProviderTest.java
b/server/src/test/java/org/apache/druid/server/log/LoggingRequestLoggerProviderTest.java
index 7642e88a8b2..304cbac99c5 100644
---
a/server/src/test/java/org/apache/druid/server/log/LoggingRequestLoggerProviderTest.java
+++
b/server/src/test/java/org/apache/druid/server/log/LoggingRequestLoggerProviderTest.java
@@ -31,6 +31,7 @@ import org.apache.druid.guice.JsonConfigurator;
import org.apache.druid.guice.ManageLifecycle;
import org.apache.druid.guice.QueryableModule;
import org.apache.druid.initialization.Initialization;
+import org.hamcrest.MatcherAssert;
import org.hamcrest.Matchers;
import org.junit.Assert;
import org.junit.Test;
@@ -77,7 +78,7 @@ public class LoggingRequestLoggerProviderTest
final Properties properties = new Properties();
properties.put(propertyPrefix + ".type", "noop");
provider.inject(properties, injector.getInstance(JsonConfigurator.class));
- Assert.assertThat(provider.get().get(),
Matchers.instanceOf(NoopRequestLogger.class));
+ MatcherAssert.assertThat(provider.get().get(),
Matchers.instanceOf(NoopRequestLogger.class));
}
private Injector makeInjector()
diff --git
a/server/src/test/java/org/apache/druid/server/log/RequestLoggerProviderTest.java
b/server/src/test/java/org/apache/druid/server/log/RequestLoggerProviderTest.java
index 0f9ece45a11..d7c3fe92718 100644
---
a/server/src/test/java/org/apache/druid/server/log/RequestLoggerProviderTest.java
+++
b/server/src/test/java/org/apache/druid/server/log/RequestLoggerProviderTest.java
@@ -25,7 +25,7 @@ import com.google.inject.ProvisionException;
import org.apache.druid.guice.JsonConfigurator;
import org.apache.druid.jackson.DefaultObjectMapper;
import org.hamcrest.CoreMatchers;
-import org.junit.Assert;
+import org.hamcrest.MatcherAssert;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
@@ -69,7 +69,7 @@ public class RequestLoggerProviderTest
RequestLoggerProvider.class,
NoopRequestLoggerProvider.class
);
- Assert.assertThat(provider,
CoreMatchers.instanceOf(NoopRequestLoggerProvider.class));
+ MatcherAssert.assertThat(provider,
CoreMatchers.instanceOf(NoopRequestLoggerProvider.class));
}
@Test
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]