### Question:
MetadataImpl extends AbstractEmptyTextComponent implements Metadata { @Override public String getLocale() { if (locale == null) { locale = currentPage == null ? Locale.getDefault().getLanguage() : currentPage.getLanguage(false).getLanguage(); } return locale; }  @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 getLocale_Default() { final String expected = Locale.getDefault().getLanguage(); ctx.currentResource("/content/metadata"); final Metadata metadata = ctx.request().adaptTo(Metadata.class); assertEquals(expected, metadata.getLocale()); }