damondouglas commented on code in PR #31853:
URL: https://github.com/apache/beam/pull/31853#discussion_r1674586217


##########
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:
   I like that we are asserting the error message contents so that we can 
validate we are sending the correct message to the developer.



-- 
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]

Reply via email to