github-advanced-security[bot] commented on code in PR #19601:
URL: https://github.com/apache/druid/pull/19601#discussion_r3441624290
##########
processing/src/test/java/org/apache/druid/java/util/common/parsers/FlatTextFormatParserTest.java:
##########
@@ -25,60 +25,52 @@
import org.apache.druid.java.util.common.StringUtils;
import
org.apache.druid.java.util.common.parsers.AbstractFlatTextFormatParser.FlatTextFormat;
import org.apache.druid.testing.InitializedNullHandlingTest;
-import org.junit.Assert;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
-import org.junit.runners.Parameterized.Parameters;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.params.Parameter;
+import org.junit.jupiter.params.ParameterizedClass;
+import org.junit.jupiter.params.provider.MethodSource;
import java.util.Arrays;
-import java.util.Collection;
import java.util.Map;
import java.util.stream.Collectors;
+import java.util.stream.Stream;
-@RunWith(Parameterized.class)
+@ParameterizedClass
+@MethodSource("constructorFeeder")
public class FlatTextFormatParserTest extends InitializedNullHandlingTest
{
- @Parameters(name = "{0}")
- public static Collection<Object[]> constructorFeeder()
+ public static Stream<Object[]> constructorFeeder()
{
return ImmutableList.of(
new Object[]{FlatTextFormat.CSV},
new Object[]{FlatTextFormat.DELIMITED}
- );
+ ).stream();
}
private static final FlatTextFormatParserFactory PARSER_FACTORY = new
FlatTextFormatParserFactory();
- @Rule
- public ExpectedException expectedException = ExpectedException.none();
-
- private final FlatTextFormat format;
-
- public FlatTextFormatParserTest(FlatTextFormat format)
- {
- this.format = format;
- }
+ @Parameter(0)
+ public FlatTextFormat format;
@Test
public void testValidHeader()
{
final String header = concat(format, "time", "value1", "value2");
final Parser<String, Object> parser = PARSER_FACTORY.get(format, header);
- Assert.assertEquals(ImmutableList.of("time", "value1", "value2"),
parser.getFieldNames());
+ Assertions.assertEquals(ImmutableList.of("time", "value1", "value2"),
parser.getFieldNames());
Review Comment:
## CodeQL / Deprecated method or constructor invocation
Invoking [Parser.getFieldNames](1) should be avoided because it has been
deprecated.
[Show more
details](https://github.com/apache/druid/security/code-scanning/11313)
--
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]