github-advanced-security[bot] commented on code in PR #19980:
URL: https://github.com/apache/druid/pull/19980#discussion_r3794061282
##########
processing/src/test/java/org/apache/druid/query/lookup/LookupExtractionFnTest.java:
##########
@@ -125,38 +126,43 @@
final LookupExtractionFn lookupExtractionFn2 =
OBJECT_MAPPER.readValue(str1, LookupExtractionFn.class);
- Assert.assertEquals(retainMissing,
lookupExtractionFn2.isRetainMissingValue());
- Assert.assertEquals(replaceMissing,
lookupExtractionFn2.getReplaceMissingValueWith());
+ Assertions.assertEquals(retainMissing,
lookupExtractionFn2.isRetainMissingValue());
+ Assertions.assertEquals(replaceMissing,
lookupExtractionFn2.getReplaceMissingValueWith());
if (injective == null) {
- Assert.assertEquals(lookupExtractionFn2.getLookup().isOneToOne(),
lookupExtractionFn2.isInjective());
+ Assertions.assertEquals(lookupExtractionFn2.getLookup().isOneToOne(),
lookupExtractionFn2.isInjective());
} else {
- Assert.assertEquals(injective, lookupExtractionFn2.isInjective());
+ Assertions.assertEquals(injective, lookupExtractionFn2.isInjective());
}
- Assert.assertArrayEquals(lookupExtractionFn.getCacheKey(),
lookupExtractionFn2.getCacheKey());
+ Assertions.assertArrayEquals(lookupExtractionFn.getCacheKey(),
lookupExtractionFn2.getCacheKey());
- Assert.assertEquals(
+ Assertions.assertEquals(
str1,
OBJECT_MAPPER.writeValueAsString(lookupExtractionFn2)
);
}
- @Test(expected = IllegalArgumentException.class)
+ @Test
public void testIllegalArgs()
{
- if (retainMissing && replaceMissing != null) {
- @SuppressWarnings("unused") // expected exception
- final LookupExtractionFn lookupExtractionFn = new LookupExtractionFn(
- new MapLookupExtractor(ImmutableMap.of("foo", "bar"), false),
- retainMissing,
- replaceMissing,
- injective,
- false
- );
- } else {
- throw new IAE("Case not valid");
- }
+ Assertions.assertThrows(
+ IllegalArgumentException.class,
+ () -> {
+ if (retainMissing && replaceMissing != null) {
+ @SuppressWarnings("unused") // expected exception
+ final LookupExtractionFn lookupExtractionFn = new
LookupExtractionFn(
+ new MapLookupExtractor(ImmutableMap.of("foo", "bar"), false),
+ retainMissing,
+ replaceMissing,
+ injective,
+ false
+ );
Review Comment:
## CodeQL / Unread local variable
Variable 'LookupExtractionFn lookupExtractionFn' is never read.
[Show more
details](https://github.com/apache/druid/security/code-scanning/11817)
--
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]