You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tika.apache.org by "THausherr (via GitHub)" <gi...@apache.org> on 2026/08/26 13:13:15 UTC

Re: [PR] [TIKA-4841] Add unit tests for Metadata reserved-key blocking, write limiter, and composite properties [tika]

THausherr commented on code in PR #2948:
URL: https://github.com/apache/tika/pull/2948#discussion_r3863062182


##########
tika-core/src/test/java/org/apache/tika/metadata/TestMetadata.java:
##########
@@ -461,6 +465,121 @@ public void testToStringWithSingleEntry() {
         assertEquals("key=value1", m.toString());
     }
 
+    /**
+     * Two Metadata instances that differ only in a value under the same key
+     * must not be equal, so value-distinct metadata are never collapsed.
+     */
+    @Test
+    public void testValueDistinctMetadataNotEqual() {
+        Metadata m1 = new Metadata();
+        m1.add("k1", "v1");
+        Metadata m2 = new Metadata();
+        m2.add("k1", "v2");
+        assertNotEquals(m1, m2);
+    }
+
+    /**
+     * Writing to reserved keys must throw an exception.
+     */
+    @Test
+    public void testReservedKeyBlockedOnUntrustedMetadata() {
+        String reservedKey = TikaCoreProperties.TIKA_META_PREFIX + "reserved";
+        Metadata m = new Metadata();
+        assertThrows(IllegalArgumentException.class, () -> m.add(reservedKey, "value"));
+    }

Review Comment:
   This is because the repository was updated.



-- 
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: dev-unsubscribe@tika.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org