### Question:
MetadataFactory { public <T> T create(final Class<T> type, final Map<String,?> properties) throws FactoryException { if (factoryMethods != null) { FactoryMethod method; synchronized (factoryMethods) { method = factoryMethods.get(type); if (method == null) { method = FactoryMethod.find(type, factories); if (method == null) { method = FactoryMethod.NULL; } else { for (final FactoryMethod existing : factoryMethods.values()) { if (method.equals(existing)) { method = existing; break; } } } factoryMethods.put(type, method); } } final Object metadata = method.create(properties); if (metadata != null) { return type.cast(metadata); } } ReflectiveOperationException failure = null; for (final MetadataStandard standard : standards) { if (standard.isMetadata(type)) { Class<?> impl = standard.getImplementation(type); if (impl == null) { impl = type; } final Object metadata; try { metadata = impl.newInstance(); } catch (ReflectiveOperationException e) { if (failure == null) { failure = e; } continue; } catch (Exception e) { throw new FactoryException(e.getLocalizedMessage(), e); } final Map<String,Object> asMap = standard.asValueMap(metadata, null, KeyNamePolicy.JAVABEANS_PROPERTY, ValueExistencePolicy.NON_EMPTY); try { asMap.putAll(properties); } catch (RuntimeException e) { throw new FactoryException(e.getLocalizedMessage(), e); } return type.cast(metadata); } } throw new FactoryException(Errors.format(Errors.Keys.UnknownType_1, type), failure); } MetadataFactory();  MetadataFactory(final MetadataStandard... standards);  MetadataFactory(final Set<?> factories, final MetadataStandard... standards); T create(final Class<T> type, final Map<String,?> properties);  }### Answer:
@Test public void testCreate() throws FactoryException { final Map<String,Object> properties = new HashMap<>(); assertNull(properties.put("title", "Undercurrent")); assertNull(properties.put("ISBN", "9782505004509")); assertNull(properties.put("presentationForm", "Document hardcopy")); final Citation citation = factory.create(Citation.class, properties); assertEquals("Undercurrent", citation.getTitle().toString()); assertEquals("9782505004509", citation.getISBN()); assertSame(PresentationForm.DOCUMENT_HARDCOPY, citation.getPresentationForms().iterator().next()); final DefaultCitation df = factory.create(DefaultCitation.class, properties); assertEquals(citation, df); }