ImmutableMapParameter implements Map<K, V> { public V put(K key, V value) { throw new UnsupportedOperationException(UNMODIFIABLE_MESSAGE); } private  ImmutableMapParameter(Map<K, V> map); static Builder<K, V> builder(); static ImmutableMapParameter<K, V> of(K k0, V v0); static ImmutableMapParameter<K, V> of(K k0, V v0, K k1, V v1); static ImmutableMapParameter<K, V> of(K k0, V v0, K k1, V v1,
            K k2, V v2); static ImmutableMapParameter<K, V> of(K k0, V v0, K k1, V v1,
            K k2, V v2, K k3, V v3); static ImmutableMapParameter<K, V> of(K k0, V v0, K k1, V v1,
            K k2, V v2, K k3, V v3, K k4, V v4); boolean containsKey(Object key); boolean containsValue(Object value); Set<Entry<K, V>> entrySet(); V get(Object key); boolean isEmpty(); Set<K> keySet(); int size(); Collection<V> values(); void clear(); V put(K key, V value); void putAll(Map<? extends K, ? extends V> map); V remove(Object key); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString();  }
@Test public void testErrorOnDuplicateKeys() { try { Map<Integer, String> builtMap = new ImmutableMapParameter.Builder<Integer, String>() .put(1, "one") .put(1, "two") .build(); fail("IllegalArgumentException expected."); } catch (IllegalArgumentException iae) { } catch (Exception e) { fail("IllegalArgumentException expected."); } }
@SuppressWarnings("unused") @Test public void testErrorOnDuplicateKeys() { try { Map<Integer, String> builtMap = new ImmutableMapParameter.Builder<Integer, String>() .put(1, "one") .put(1, "two") .build(); fail("IllegalArgumentException expected."); } catch (IllegalArgumentException iae) { } catch (Exception e) { fail("IllegalArgumentException expected."); } }