@Test
public void testMap() {

  assertNull(Protected.object((Map<?, ?>) null));
  assertSame(Collections.emptyMap(), Protected.object(Collections.emptyMap()));
  Map<String, String> singletonMap = new HashMap<String, String>();
  singletonMap.put("a", "b");
  assertEquals(Collections.singletonMap("a", "b").getClass(), Protected.object(singletonMap)
      .getClass());
  Map<String, String> input = new HashMap<String, String>();
  input.put("a", "b");
  input.put("c", "d");
  input.put("e", "f");
  Map<String, String> output = Protected.object(input);
  assertEquals(input, output);
  assertNotSame(input, output);
  // Protecting a protected list should be idempotent
  assertSame(output, Protected.object(output));
  // But re-protecting the input list shouldn't be
  assertNotSame(output, Protected.object(input));
  // Mutations to input list aren't visible
  input.put("a", "q");
  assertEquals("b", output.get("a"));
  // Changes to the protected list fail
  try {
    output.put("a", "b");
    fail();
  } catch (UnsupportedOperationException expected) {}
}