### Question:
PropertiesHolder implements IHasProperties { @Override public String toString() { if ( properties == null ) { return super.toString(); } return properties.toString(); } PropertiesHolder(); @Override Object getProperty( String key ); String getPropertyAsString( String key ); @Override void setProperty( String key, Object value ); @Override Object removeProperty( String key ); @Override Set<String> getPropertyKeys(); @Override Map<String, Object> getProperties(); @Override void setProperties( Map<String, Object> props ); @Override void removeProperties( Set<String> keys ); @Override void clearProperties(); @Override boolean containsKey( String key ); @Override boolean isDirty(); @Override void setDirty( boolean dirty ); @Override String toString();  }### Answer:
@Test public void testToString() throws Exception { PropertiesHolder props = new PropertiesHolder(); assertEquals( "{}", props.toString() ); Map<String, Object> setProps = new HashMap<String, Object>( 3 ); setProps.put( "a", 1 ); setProps.put( "b", 2 ); setProps.put( "c", 3 ); props.setProperties( setProps ); System.out.println( props.toString() ); assertTrue( props.toString().contains( "b=2" ) ); assertTrue( props.toString().contains( "c=3" ) ); assertTrue( props.toString().contains( "a=1" ) ); }
@Test public void testToString_nullProperties() throws Exception { props.properties = null; assertNotNull( props.toString() ); }