### Question:
BasicGadgetAdminStore implements GadgetAdminStore { public boolean isAllowedFeature(Feature feature, Gadget gadget) { String container = getSafeContainerFromGadget(gadget); String gadgetUrl = getSafeGadgetUrlFromGadget(gadget); if (container == null || gadgetUrl == null) { return false; } if (!isFeatureAdminEnabled(container)) { return true; } if (!hasGadgetAdminData(container, gadgetUrl)) { return false; } GadgetAdminData gadgetAdminData = getGadgetAdminData(container, gadgetUrl); FeatureAdminData featureAdminData = gadgetAdminData.getFeatureAdminData(); String featureName = feature.getName(); switch (featureAdminData.getType()) { case BLACKLIST: return !featureAdminData.getFeatures().contains(featureName); case WHITELIST: default: return featureAdminData.getFeatures().contains(featureName); } } @Inject  BasicGadgetAdminStore(FeatureRegistryProvider featureRegistryProvider,
          ContainerConfig config, ServerAdminData serverAdminData); void init(String store); GadgetAdminData getGadgetAdminData(String container, String gadgetUrl); void setGadgetAdminData(String container, String gadgetUrl, GadgetAdminData adminData); ContainerAdminData getContainerAdminData(String container); void setContainerAdminData(String container, ContainerAdminData containerAdminData); ServerAdminData getServerAdminData(); boolean checkFeatureAdminInfo(Gadget gadget); boolean isAllowedFeature(Feature feature, Gadget gadget); boolean isWhitelisted(String container, String gadgetUrl); Set<String> getAdditionalRpcServiceIds(Gadget gadget);  }### Answer:
@Test public void testIsAllowedFeature() throws Exception { mockGadget(ImmutableList.<Feature> of(), DEFAULT, TODO); Feature denied = createMockFeature("setprefs", true); Feature allowed = createMockFeature("foo", true); replay(); assertFalse(enabledStore.isAllowedFeature(denied, mockGadget)); assertTrue(enabledStore.isAllowedFeature(allowed, mockGadget)); assertTrue(disabledStore.isAllowedFeature(denied, mockGadget)); assertTrue(disabledStore.isAllowedFeature(allowed, mockGadget)); }