### Question:
Gadget { public LocaleSpec getLocale() { View view = getCurrentView(); String viewName = (view == null) ? GadgetSpec.DEFAULT_VIEW : view.getName(); return spec.getModulePrefs().getLocale(context.getLocale(), viewName); }  Gadget setContext(GadgetContext context); GadgetContext getContext(); synchronized Gadget setGadgetFeatureRegistry(FeatureRegistry registry); Gadget setSpec(GadgetSpec spec); GadgetSpec getSpec(); OpenSocialVersion getSpecificationVersion(); boolean useQuirksMode(); Gadget setPreloads(Collection<PreloadedData> preloads); Collection<PreloadedData> getPreloads(); synchronized List<String> getAllFeatures(); Gadget setCurrentView(View currentView); View getCurrentView(); LocaleSpec getLocale(); void addFeature(String name); void removeFeature(String name); Set<String> getDirectFeatureDeps(); Map<String, Feature> getViewFeatures(); boolean sanitizeOutput(); boolean requiresCaja();  }### Answer:
@Test public void getLocale() throws Exception { Gadget gadget = new Gadget() .setContext(context) .setSpec(new GadgetSpec(Uri.parse(SPEC_URL), SPEC_XML)); LocaleSpec localeSpec = gadget.getLocale(); assertEquals("VALUE", localeSpec.getMessageBundle().getMessages().get("name")); }