public void testUnsupportedOperation()
{
MultivaluedMap<String, String> m = new MultivaluedMapImpl();
m.add("hello", "world");
InputHeadersMap um = new InputHeadersMap(m);
try
{
um.clear();
fail("UnsupportedOperationException should be thrown fro 'clear'");
}
catch (UnsupportedOperationException e)
{
}
try
{
um.remove("hello");
fail("UnsupportedOperationException should be thrown for 'remove'");
}
catch (UnsupportedOperationException e)
{
}
try
{
um.put("bar", new ArrayList<String>());
fail("UnsupportedOperationException should be thrown for 'put'");
}
catch (UnsupportedOperationException e)
{
}
try
{
um.putAll(new MultivaluedMapImpl());
fail("UnsupportedOperationException should be thrown for 'puAll'");
}
catch (UnsupportedOperationException e)
{
}
try
{
um.putSingle("foo", "bar");
fail("UnsupportedOperationException should be thrown for 'putSingle'");
}
catch (UnsupportedOperationException e)
{
}
try
{
um.add("foo", "bar");
fail("UnsupportedOperationException should be thrown for 'add'");
}
catch (UnsupportedOperationException e)
{
}
try
{
um.entrySet().remove(null);
fail("UnsupportedOperationException should be thrown");
}
catch (UnsupportedOperationException e)
{
}
try
{
um.entrySet().removeAll(null);
fail("UnsupportedOperationException should be thrown");
}
catch (UnsupportedOperationException e)
{
}
try
{
um.entrySet().retainAll(null);
fail("UnsupportedOperationException should be thrown");
}
catch (UnsupportedOperationException e)
{
}
try
{
Iterator<Map.Entry<String, List<String>>> i = um.entrySet().iterator();
while (i.hasNext())
i.remove();
fail("UnsupportedOperationException should be thrown");
}
catch (UnsupportedOperationException e)
{
}
try
{
um.entrySet().iterator().next().setValue(null);
fail("UnsupportedOperationException should be thrown");
}
catch (UnsupportedOperationException e)
{
}
try
{
um.keySet().remove("hello");
fail("UnsupportedOperationException should be thrown");
}
catch (UnsupportedOperationException e)
{
}
try
{
um.keySet().removeAll(null);
fail("UnsupportedOperationException should be thrown");
}
catch (UnsupportedOperationException e)
{
}
try
{
um.keySet().retainAll(null);
fail("UnsupportedOperationException should be thrown");
}
catch (UnsupportedOperationException e)
{
}
try
{
Iterator<String> i = um.keySet().iterator();
while (i.hasNext())
i.remove();
fail("UnsupportedOperationException should be thrown");
}
catch (UnsupportedOperationException e)
{
}
try
{
um.get("hello").clear();
fail("UnsupportedOperationException should be thrown");
}
catch (UnsupportedOperationException e)
{
}
try
{
um.values().clear();
fail("UnsupportedOperationException should be thrown");
}
catch (UnsupportedOperationException e)
{
}
try
{
um.keySet().clear();
fail("UnsupportedOperationException should be thrown");
}
catch (UnsupportedOperationException e)
{
}