### Question:
PropertiesRepresentation extends MappingRepresentation { @Override protected void serialize( MappingSerializer serializer ) { serialize( serializer.writer ); } PropertiesRepresentation( PropertyContainer entity ); @Override boolean isEmpty(); static Representation value( Object property );  }### Answer:
@Test public void shouldContainAddedPropertiesWhenCreatedFromPropertyContainer() { Map<String, Object> values = new HashMap<>(); values.put( "foo", "bar" ); Map<String, Object> serialized = serialize( new PropertiesRepresentation( container( values ) ) ); assertEquals( "bar", serialized.get( "foo" ) ); }
@Test public void shouldSerializeToMapWithSamePropertiesWhenCreatedFromPropertyContainer() { Map<String, Object> values = new HashMap<>(); values.put( "foo", "bar" ); PropertiesRepresentation properties = new PropertiesRepresentation( container( values ) ); Map<String, Object> map = serialize( properties ); assertEquals( values, map ); }
@Test public void shouldSerializeToMap() { Map<String, Object> values = new HashMap<>(); values.put( "string", "value" ); values.put( "int", 5 ); values.put( "long", 17L ); values.put( "double", 3.14 ); values.put( "float", 42.0f ); values.put( "string array", new String[] { "one", "two" } ); values.put( "long array", new long[] { 5L, 17L } ); values.put( "double array", new double[] { 3.14, 42.0 } ); PropertiesRepresentation properties = new PropertiesRepresentation( container( values ) ); Map<String, Object> map = serialize( properties ); assertEquals( "value", map.get( "string" ) ); assertEquals( 5, ( (Number) map.get( "int" ) ).longValue() ); assertEquals( 17, ( (Number) map.get( "long" ) ).longValue() ); assertEquals( 3.14, ( (Number) map.get( "double" ) ).doubleValue(), 0.0 ); assertEquals( 42.0, ( (Number) map.get( "float" ) ).doubleValue(), 0.0 ); assertEqualContent( Arrays.asList( "one", "two" ), (List) map.get( "string array" ) ); assertEqualContent( Arrays.asList( 5L, 17L ), (List) map.get( "long array" ) ); assertEqualContent( Arrays.asList( 3.14, 42.0 ), (List) map.get( "double array" ) ); }