CaseInsensitiveKeysMapAccess { public static Map<String, String> convert(Map<String, String> map) { Map<String, String> caseInsensitiveMap = new TreeMap<>(String.CASE_INSENSITIVE_ORDER); if (map != null) { caseInsensitiveMap.putAll(map); } return Collections.unmodifiableMap(caseInsensitiveMap); }  static Map<String, String> convert(Map<String, String> map);  }
@Test public void convert() { Map<String, String> map = CaseInsensitiveKeysMapAccess.convert(Collections.singletonMap("hello", "world")); assertEquals("world", map.get("hello")); assertEquals("world", map.get("Hello")); assertEquals("world", map.get("hELLO")); }
@Test(expected = UnsupportedOperationException.class) public void assertImmutable() { Map<String, String> map = CaseInsensitiveKeysMapAccess.convert(Collections.singletonMap("hello", "world")); map.put("foo", "bar"); }