singhpk234 commented on code in PR #14739:
URL: https://github.com/apache/iceberg/pull/14739#discussion_r2589554229


##########
core/src/test/java/org/apache/iceberg/TestContentFileParser.java:
##########
@@ -210,6 +210,74 @@ public void testPartitionArrayRespectsSpecOrder() throws 
Exception {
     assertThat(deserializedContentFile.partition().get(1, 
String.class)).isEqualTo("foo");
   }
 
+  @Test
+  public void testInvalidContentType() throws Exception {
+    String jsonStr =
+        "{\"spec-id\":0,"
+            + "\"content\":\"invalid-content\","
+            + "\"file-path\":\"/path/to/file.parquet\","
+            + "\"file-format\":\"parquet\","
+            + "\"partition\":{},"
+            + "\"file-size-in-bytes\":1,"
+            + "\"record-count\":1}";
+
+    JsonNode node = JsonUtil.mapper().readTree(jsonStr);
+
+    assertThatThrownBy(
+            () -> ContentFileParser.fromJson(node, Map.of(0, 
PartitionSpec.unpartitioned())))
+        .isInstanceOf(IllegalArgumentException.class)
+        .hasMessage("Invalid file content value: 'invalid-content'");
+  }
+
+  @Test
+  public void testUppercaseFileFormat() throws Exception {

Review Comment:
   minor : can we add its a deserialization test case ? and make it a 
parameterized test 
   {serializedContent, serializedFormat, expectedDeserializedContent, 
expectedDeserialziedFormat}
   .....
   { "DATA", "PARQUET", "DATA", "PARQUET"} 
   {"data", "parquet", "DATA", "PARQUET"} 
   {"POSITION_DELETE", "PUFFIN", "POSITION_DELETE", "PUFFIN" }
   {"position-delete", "puffin", "POSITION_DELETE", "PUFFIN" }



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

Reply via email to