FrankChen021 commented on code in PR #20031:
URL: https://github.com/apache/druid/pull/20031#discussion_r3800359607
##########
server/src/test/java/org/apache/druid/query/dimension/LookupDimensionSpecTest.java:
##########
@@ -217,22 +220,22 @@
};
}
- @Test
- @Parameters
+ @ParameterizedTest
+ @MethodSource("parametersForTestGetCacheKey")
public void testGetCacheKey(DimensionSpec dimensionSpec, boolean
expectedResult)
{
- Assert.assertEquals(expectedResult,
Arrays.equals(lookupDimSpec.getCacheKey(), dimensionSpec.getCacheKey()));
+ Assertions.assertEquals(expectedResult,
Arrays.equals(lookupDimSpec.getCacheKey(), dimensionSpec.getCacheKey()));
}
@Test
public void testPreservesOrdering()
{
- Assert.assertFalse(lookupDimSpec.preservesOrdering());
+ Assertions.assertFalse(lookupDimSpec.preservesOrdering());
}
@Test
public void testIsOneToOne()
{
- Assert.assertEquals(lookupDimSpec.getExtractionFn().getExtractionType(),
ExtractionFn.ExtractionType.ONE_TO_ONE);
+
Assertions.assertEquals(lookupDimSpec.getExtractionFn().getExtractionType(),
ExtractionFn.ExtractionType.ONE_TO_ONE);
Review Comment:
I checked this against the PR base commit cb26014728. The
DimensionSpec.getExtractionFn call was already present in the pre-migration
testIsOneToOne; this PR only changed the JUnit annotation and assertion styles.
The deprecation is not introduced by this PR, so I am leaving the code
unchanged.
##########
server/src/test/java/org/apache/druid/client/indexing/ClientCompactionTaskDimensionsSpecTest.java:
##########
@@ -58,14 +59,16 @@
json,
ClientCompactionTaskDimensionsSpec.class
);
- Assert.assertEquals(expected, fromJson);
+ Assertions.assertEquals(expected, fromJson);
}
- @Test(expected = ParseException.class)
+ @Test
public void testInvalidDimensionsField()
{
- final ClientCompactionTaskDimensionsSpec expected = new
ClientCompactionTaskDimensionsSpec(
- DimensionsSpec.getDefaultSchemas(ImmutableList.of("ts", "dim", "dim"))
- );
+ Assertions.assertThrows(ParseException.class, () -> {
+ final ClientCompactionTaskDimensionsSpec expected = new
ClientCompactionTaskDimensionsSpec(
+ DimensionsSpec.getDefaultSchemas(ImmutableList.of("ts", "dim",
"dim"))
+ );
Review Comment:
I checked this against the PR base commit cb26014728. The
ClientCompactionTaskDimensionsSpec expected local was already unused in the
pre-migration testInvalidDimensionsField; this PR only wrapped the existing
constructor in JUnit 5 assertThrows. Since this finding predates the PR, I am
leaving the code unchanged.
##########
server/src/test/java/org/apache/druid/client/cache/CacheConfigTest.java:
##########
@@ -147,17 +152,19 @@
properties.put(PROPERTY_PREFIX + ".populateCache", "FALSE");
configProvider.inject(properties, configurator);
CacheConfig config = configProvider.get();
- Assert.assertFalse(config.isPopulateCache());
+ Assertions.assertFalse(config.isPopulateCache());
}
- @Test(expected = ProvisionException.class)
+ @Test
public void testMixedCaseFalseIsRejected()
{
- properties.put(PROPERTY_PREFIX + ".populateCache", "FaLse");
- configProvider.inject(properties, configurator);
- CacheConfig config = configProvider.get();
- throw new IllegalStateException("Should have already failed");
+ Assertions.assertThrows(ProvisionException.class, () -> {
+ properties.put(PROPERTY_PREFIX + ".populateCache", "FaLse");
+ configProvider.inject(properties, configurator);
+ CacheConfig config = configProvider.get();
Review Comment:
I checked this against the PR base commit cb26014728. The CacheConfig config
local was already present and unused in the pre-migration
testMixedCaseFalseIsRejected; this PR only converted the JUnit 4
expected-exception syntax. Since this finding predates the PR, I am leaving the
code unchanged.
##########
server/src/test/java/org/apache/druid/client/selector/ServerSelectorTest.java:
##########
@@ -101,17 +102,19 @@
.build()
);
- Assert.assertEquals(ImmutableList.of("a", "b", "c"),
selector.getSegment().getDimensions());
+ Assertions.assertEquals(ImmutableList.of("a", "b", "c"),
selector.getSegment().getDimensions());
}
- @Test(expected = NullPointerException.class)
+ @Test
public void testSegmentCannotBeNull()
{
- final ServerSelector selector = new ServerSelector(
- null,
- new HighestPriorityTierSelectorStrategy(new
RandomServerSelectorStrategy()),
- HistoricalFilter.IDENTITY_FILTER
- );
+ Assertions.assertThrows(NullPointerException.class, () -> {
+ final ServerSelector selector = new ServerSelector(
+ null,
+ new HighestPriorityTierSelectorStrategy(new
RandomServerSelectorStrategy()),
+ HistoricalFilter.IDENTITY_FILTER
+ );
Review Comment:
I checked this against the PR base commit cb26014728. The ServerSelector
selector local was already unused in the pre-migration testSegmentCannotBeNull;
this PR only wrapped the existing constructor in JUnit 5 assertThrows. Since
this finding predates the PR, I am leaving the code unchanged.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]