diff --git a/test/org/apache/catalina/util/TestParameterMap.java b/test/org/apache/catalina/util/TestParameterMap.java index 87ead7f60243..92d801a32b88 100644 --- a/test/org/apache/catalina/util/TestParameterMap.java +++ b/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) 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) 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 map = new ParameterMap<>(); + Assert.assertTrue(map.isEmpty()); + } } \ No newline at end of file