markt-asf commented on code in PR #962:
URL: https://github.com/apache/tomcat/pull/962#discussion_r2965356454
##########
test/org/apache/catalina/util/TestParameterMap.java:
##########
@@ -300,11 +300,37 @@ public void testEntrySetImmutabilityAfterLocked() {
Assert.fail("ParameterMap is not locked.");
} catch (UnsupportedOperationException expectedException) {
}
-
try {
entrySet.clear();
Assert.fail("ParameterMap is not locked.");
} catch (UnsupportedOperationException expectedException) {
}
}
+ @Test
+ public void testComputeIfAbsentAfterLocked() {
+ ((ParameterMap<String, String[]>) paramMap).setLocked(true);
+
+ try {
+ paramMap.computeIfAbsent("param5", k -> new String[]{"value5"});
+ Assert.fail("ParameterMap is not locked.");
+ } catch (IllegalStateException expectedException) {
+ }
+ }
+
+ @Test
+ public void testComputeAfterLocked() {
+ ((ParameterMap<String, String[]>) paramMap).setLocked(true);
+
+ try {
+ paramMap.compute("param1", (k, v) -> new String[]{"changed"});
+ Assert.fail("ParameterMap is not locked.");
+ } catch (IllegalStateException expectedException) {
+ }
+ }
+
+ @Test
+ public void testEmptyParameterMap() {
+ Map<String,String[]> map = new ParameterMap<>();
+ Assert.assertTrue(map.isEmpty());
+ }
Review Comment:
What has this got to do with the stated purpose of the PR?
--
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]