### Question:
FeatureRegistry { public List<String> getFeatures(Collection<String> needed) { List<FeatureNode> fullTree = getTransitiveDeps(needed, Lists.<String>newLinkedList()); List<String> allFeatures = Lists.newLinkedList(); for (FeatureNode node : fullTree) { allFeatures.add(node.name); } return allFeatures; } @Inject  FeatureRegistry(FeatureResourceLoader resourceLoader,
                         @Named("org.apache.shindig.features") List<String> features); List<FeatureResource> getFeatureResources(
      GadgetContext ctx, Collection<String> needed, List<String> unsupported, boolean transitive); List<FeatureResource> getFeatureResources(GadgetContext ctx, Collection<String> needed, List<String> unsupported); List<FeatureResource> getAllFeatures(); List<String> getFeatures(Collection<String> needed); Set<String> getAllFeatureNames(); static final String RESOURCE_SCHEME; static final String FILE_SCHEME; }### Answer:
@Test public void getFeaturesStringsNoTransitive() throws Exception { setupFullRegistry("gadget", null); List<String> needed = Lists.newArrayList("nodep", "bottom"); List<String> featureNames = registry.getFeatures(needed); assertEquals(2, featureNames.size()); assertEquals("nodep", featureNames.get(0)); assertEquals("bottom", featureNames.get(1)); }
@Test public void getFeaturesStringsTransitive() throws Exception { setupFullRegistry("gadget", null); List<String> needed = Lists.newArrayList("top", "nodep"); List<String> featureNames = registry.getFeatures(needed); assertEquals(5, featureNames.size()); assertEquals("bottom", featureNames.get(0)); assertEquals("mid_a", featureNames.get(1)); assertEquals("mid_b", featureNames.get(2)); assertEquals("top", featureNames.get(3)); assertEquals("nodep", featureNames.get(4)); }