@Test
public void deserialize() {

    Metadata metadata = new MetadataDeserializer().deserialize(map);
    assertEquals(123, metadata.getMetadata("custom", "id"));
    assertEquals("Bloggs", metadata.getMetadata("custom", "surname"));
    assertTrue((Boolean) metadata.getMetadata("data", "optIn"));
}