PluginSortStrategy { public List<Plugin> sortPlugins() { addVertices(); addEdges(); return sortGraph(); } PluginSortStrategy(FacetRegistry facetRegistry, List<Plugin> unOrderedPlugins); List<Plugin> sortPlugins();  }
@Test public void test_sort_plugins_with_dependencies() { Plugin1 plugin1 = new Plugin1(); Plugin2 plugin2 = new Plugin2(); Plugin3 plugin3 = new Plugin3(); Plugin4 plugin4 = new Plugin4(); List<Plugin> plugins = Lists.newArrayList(plugin4, plugin2, plugin3, plugin1); FacetRegistry facetRegistry = new FacetRegistry(plugins); PluginSortStrategy strategy = new PluginSortStrategy(facetRegistry, plugins); List<Plugin> orderedPlugins = strategy.sortPlugins(); assertThat(plugins).containsSequence(plugin4, plugin2, plugin3, plugin1); assertThat(orderedPlugins).containsSequence(plugin1, plugin2, plugin3, plugin4); }