MetadataDeserializer implements MapDeserializer<Metadata> { @Override public Metadata deserialize(Map<String, Object> map) { ConcurrentHashMap<String, Object> store = new ConcurrentHashMap<>(map); return new Metadata(store); }  @Override Metadata deserialize(Map<String, Object> map);  }
@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")); }