Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 27 additions & 1 deletion test/org/apache/catalina/util/TestParameterMap.java
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}
}