[
https://issues.apache.org/jira/browse/TIKA-4841?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18108308#comment-18108308
]
ASF GitHub Bot commented on TIKA-4841:
--------------------------------------
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.
> Add unit tests for Metadata
> ---------------------------
>
> Key: TIKA-4841
> URL: https://issues.apache.org/jira/browse/TIKA-4841
> Project: Tika
> Issue Type: Improvement
> Components: metadata
> Affects Versions: 4.0.0
> Reporter: Tilman Hausherr
> Priority: Minor
> Fix For: 4.1.0
>
>
> Ticket for PR#2948 which expands the Metadata tests.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)