### Question:
Settings extends AttributeContainerAny <String> implements ISettings { @Nonnull @Override public EChange putIn (@Nonnull @Nonempty final String sName, @Nullable final Object aNewValue) { ValueEnforcer.notEmpty (sName, "Name"); return super.putIn (sName, aNewValue); } Settings(@Nonnull @Nonempty final String sName);  Settings(@Nonnull final ISettings aOther); @Nonnull @Override EChange putIn(@Nonnull @Nonempty final String sName, @Nullable final Object aNewValue); @Nonnull @Nonempty final String getName(); @Override boolean equals(final Object o); @Override int hashCode(); @Override String toString();  }### Answer:
@SuppressWarnings ("unused") @Test @SuppressFBWarnings ("NP_NONNULL_PARAM_VIOLATION") public void testIllegal () { try { new Settings ((String) null); fail (); } catch (final NullPointerException ex) {} try { new Settings (""); fail (); } catch (final IllegalArgumentException ex) {} try { new Settings ("xxx").putIn (null, "my value"); fail (); } catch (final NullPointerException ex) {} try { new Settings ("xxx").putIn ("", "my value"); fail (); } catch (final IllegalArgumentException ex) {} }
@Test public void testStdMethods () { final Settings s = new Settings ("s1"); assertTrue (s.putIn (FIELD1, "My value").isChanged ()); { final Settings t = new Settings ("s1"); assertTrue (t.putIn (FIELD1, "My value").isChanged ()); CommonsTestHelper.testDefaultImplementationWithEqualContentObject (s, t); } { final Settings t = new Settings ("s1"); t.putIn (FIELD1, "My other value"); CommonsTestHelper.testDefaultImplementationWithDifferentContentObject (s, t); } { final Settings t = new Settings ("other name"); t.putIn (FIELD1, "My value"); CommonsTestHelper.testDefaultImplementationWithDifferentContentObject (s, t); } }
@Test public void testNull () { final Settings s = new Settings ("s1"); assertTrue (s.putIn (FIELD1, "My value").isChanged ()); assertTrue (s.keySet ().contains (FIELD1)); assertFalse (s.keySet ().contains (FIELD2)); assertFalse (s.putIn (FIELD2, null).isChanged ()); assertTrue (s.keySet ().contains (FIELD1)); assertTrue (s.keySet ().contains (FIELD2)); }
@Test public void testCopy () { final Settings s = new Settings ("s1"); assertTrue (s.putIn (FIELD1, "My value").isChanged ()); final Settings s2 = new Settings (s); assertTrue (s2.keySet ().contains (FIELD1)); assertFalse (s2.keySet ().contains (FIELD2)); assertTrue (s2.putIn (FIELD2, "Other value").isChanged ()); assertTrue (s.keySet ().contains (FIELD1)); assertFalse (s.keySet ().contains (FIELD2)); assertTrue (s2.keySet ().contains (FIELD1)); assertTrue (s2.keySet ().contains (FIELD2)); }