FrankChen021 commented on code in PR #19601:
URL: https://github.com/apache/druid/pull/19601#discussion_r3452105336
##########
processing/src/test/java/org/apache/druid/java/util/common/parsers/FlatTextFormatParserTest.java:
##########
@@ -176,44 +168,42 @@ public void testWithDifferentHeaderRows()
concat(format, "time", "value1", "value2"),
concat(format, "hello", "world", "foo")
};
- Assert.assertNull(parser.parseToMap(body[0]));
+ Assertions.assertNull(parser.parseToMap(body[0]));
Map<String, Object> jsonMap = parser.parseToMap(body[1]);
- Assert.assertEquals(
- "jsonMap",
+ Assertions.assertEquals(
ImmutableMap.of("time", "hello", "value1", "world", "value2", "foo"),
- jsonMap
+ jsonMap,
+ "jsonMap"
);
parser.startFileFromBeginning();
final String[] body2 = new String[]{
concat(format, "time", "value1", "value2", "value3"),
concat(format, "hello", "world", "foo", "bar")
};
- Assert.assertNull(parser.parseToMap(body2[0]));
+ Assertions.assertNull(parser.parseToMap(body2[0]));
jsonMap = parser.parseToMap(body2[1]);
- Assert.assertEquals(
- "jsonMap",
+ Assertions.assertEquals(
ImmutableMap.of("time", "hello", "value1", "world", "value2", "foo",
"value3", "bar"),
- jsonMap
+ jsonMap,
+ "jsonMap"
);
}
@Test
public void testWithoutStartFileFromBeginning()
{
- expectedException.expect(UnsupportedOperationException.class);
- expectedException.expectMessage(
- "hasHeaderRow or maxSkipHeaderRows is not supported. Please check the
indexTask supports these options."
- );
-
final int skipHeaderRows = 2;
final Parser<String, Object> parser = PARSER_FACTORY.get(format, false,
skipHeaderRows, false);
final String[] body = new String[]{
concat(format, "header", "line", "1"),
concat(format, "header", "line", "2"),
concat(format, "hello", "world", "foo")
};
- parser.parseToMap(body[0]);
+ Assertions.assertThrows(
Review Comment:
[P3] Restore the expected exception message assertion
The JUnit 4 version of this test checked that the
UnsupportedOperationException message contained `hasHeaderRow or
maxSkipHeaderRows is not supported...`, but the Jupiter conversion now only
asserts the exception type. A regression that throws the same exception for the
wrong reason or drops the user-facing diagnostic would pass this test. Capture
the thrown exception and assert the message, as done for
`testDuplicatedColumnName`.
--
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]