### Question:
MetadataImpl extends AbstractEmptyTextComponent implements Metadata { @Override public String getFormat() { if (type == null) { getType(); } switch (type) { case DATE: return formatDate; case NUMBER: return formatNumber; default: return null; } }  @PostConstruct void init(); @Override DataType getType(); @Override String getLocale(); @Override String getFormat(); @Override ValueMap getProperties(); @Override AssetModel getAsset(); @Override String getPropertyName(); @Override boolean isEmpty(); @Override boolean isReady(); @Nonnull @Override String getExportedType();  }### Answer:
@Test public void getFormat_Date() { final String expected = "yyyy-MM-dd"; ctx.currentResource("/content/date"); final Metadata metadata = ctx.request().adaptTo(Metadata.class); assertEquals(expected, metadata.getFormat()); }
@Test public void getFormat_Number() { final String expected = "#.###"; ctx.currentResource("/content/number"); final Metadata metadata = ctx.request().adaptTo(Metadata.class); assertEquals(expected, metadata.getFormat()); }
@Test public void getFormat() { ctx.currentResource("/content/metadata"); final Metadata metadata = ctx.request().adaptTo(Metadata.class); assertNull(metadata.getFormat()); }