### Question:
SingleElementMap implements ICommonsMap <KEYTYPE, VALUETYPE> { @Nullable public final VALUETYPE put (@Nullable final KEYTYPE aKey, @Nullable final VALUETYPE aElement) { VALUETYPE aOldElement = null; if (EqualsHelper.equals (aKey, m_aKey)) { aOldElement = m_aValue; } else { m_aKey = aKey; } m_aValue = aElement; m_bHasElement = true; return aOldElement; } SingleElementMap();  SingleElementMap(@Nullable final KEYTYPE aKey, @Nullable final VALUETYPE aValue); @Nonnull @ReturnsMutableCopy SingleElementMap <KEYTYPE, VALUETYPE> getClone(); void clear(); boolean containsKey(@Nullable final Object aKey); boolean containsValue(@Nullable final Object aValue); @Nullable VALUETYPE get(@Nullable final Object aKey); boolean isEmpty(); @Nullable final VALUETYPE put(@Nullable final KEYTYPE aKey, @Nullable final VALUETYPE aElement); void putAll(@Nullable final Map <? extends KEYTYPE, ? extends VALUETYPE> aMap); @Nullable VALUETYPE remove(@Nullable final Object aKey); @Nonnegative int size(); @ReturnsImmutableObject @Nonnull @CodingStyleguideUnaware Set <KEYTYPE> keySet(); @ReturnsImmutableObject @Nonnull Collection <VALUETYPE> values(); @Nonnull @ReturnsMutableCopy @CodingStyleguideUnaware Set <Map.Entry <KEYTYPE, VALUETYPE>> entrySet(); @Override boolean equals(final Object o); @Override int hashCode(); @Override String toString();  }### Answer:
@Test public void testPut () { final Map <String, Integer> aMap = new SingleElementMap <> (); assertEquals (0, aMap.size ()); assertNull (aMap.put ("any", I1)); assertEquals (1, aMap.size ()); assertEquals (I1, aMap.put ("any", I1)); assertEquals (1, aMap.size ()); assertEquals (I1, aMap.put ("any", I2)); assertEquals (1, aMap.size ()); assertEquals (I2, aMap.put ("any", I3)); assertEquals (1, aMap.size ()); assertEquals (I3, aMap.put ("any", null)); assertEquals (1, aMap.size ()); assertEquals (null, aMap.put ("any", null)); assertEquals (1, aMap.size ()); assertEquals (null, aMap.put ("any", I2)); aMap.putAll (aMap); aMap.putAll (new HashMap <String, Integer> ()); try { aMap.putAll (CollectionHelper.newMap (new String [] { "x", "y" }, new Integer [] { I1, I2 })); fail (); } catch (final IllegalArgumentException ex) {} }