Abacn commented on code in PR #31853:
URL: https://github.com/apache/beam/pull/31853#discussion_r1675965841
##########
sdks/java/io/csv/src/test/java/org/apache/beam/sdk/io/csv/CsvIOParseHelpersTest.java:
##########
@@ -33,6 +34,77 @@
@RunWith(JUnit4.class)
public class CsvIOParseHelpersTest {
+ /** Tests for {@link CsvIOParseHelpers#validate(CSVFormat)}. */
+ @Test
+ public void givenCSVFormatWithHeader_validates() {
+ CSVFormat format = csvFormatWithHeader();
+ CsvIOParseHelpers.validate(format);
+ }
+
+ @Test
+ public void givenCSVFormatWithNullHeader_throwsException() {
+ CSVFormat format = csvFormat();
+ String gotMessage =
+ assertThrows(IllegalArgumentException.class, () ->
CsvIOParseHelpers.validate(format))
+ .getMessage();
+ assertEquals("Illegal class org.apache.commons.csv.CSVFormat: header is
required", gotMessage);
Review Comment:
IllegalArgumentException is already checked by "assertThrows". The Exception
type is generally more stable than the error message.
--
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]