Source:
public void addMulePluginTest() throws URISyntaxException { Dependency mulePlugin1 = buildDependency(MULE_PLUGIN_CLASSIFIER); Dependency mulePlugin2 = buildDependency(MULE_PLUGIN_CLASSIFIER); SortedSet<Dependency> mulePlugin1Dependencies = new TreeSet<>(buildDependencySet(CONSTANT_NUMBER_DEPENDENCIES, null)); SortedSet<Dependency> mulePlugin2Dependencies = new TreeSet<>(buildDependencySet(INITIAL_NUMBER_DEPENDENCIES, null)); SortedMap<Dependency, SortedSet<Dependency>> mulePlugins = new TreeMap<>(); mulePlugins.put(mulePlugin1, mulePlugin1Dependencies); mulePlugins.put(mulePlugin2, mulePlugin2Dependencies); ClassLoaderModel model = new ClassLoaderModel(VERSION, buildArtifactCoordinates(MULE_APPLICATION_CLASSIFIER)); model.setMulePlugins(mulePlugins); SortedSet<Dependency> additionalMulePlugin2Dependencies = new TreeSet<>(buildDependencySet(ADDITIONAL_NUMBER_DEPENDENCIES, null)); model.addMulePlugin(mulePlugin2, additionalMulePlugin2Dependencies); SortedMap<Dependency, SortedSet<Dependency>> actualMulePlugins = model.getMulePlugins(); assertThat("Number of mule plugins in set is not the expected", actualMulePlugins.keySet().size(), equalTo(NUMBER_MULE_PLUGINS)); assertThat("Mule plugins set is not the expected", actualMulePlugins.keySet(), containsInAnyOrder(mulePlugin1, mulePlugin2)); assertThat("Number of dependencies of mulePlugin1 is not the expected", actualMulePlugins.get(mulePlugin1).size(), equalTo(CONSTANT_NUMBER_DEPENDENCIES)); assertThat("Number of dependencies of mulePlugin2 is not the expected", actualMulePlugins.get(mulePlugin2).size(), equalTo(INITIAL_NUMBER_DEPENDENCIES + ADDITIONAL_NUMBER_DEPENDENCIES)); }

Target:
public void addMulePluginTest() throws URISyntaxException { Dependency mulePlugin1 = buildDependency(MULE_PLUGIN_CLASSIFIER); Dependency mulePlugin2 = buildDependency(MULE_PLUGIN_CLASSIFIER); SortedSet<Dependency> mulePlugin1Dependencies = new TreeSet<>(buildDependencySet(ARBITRARY_NUMBER_DEPENDENCIES, null)); SortedSet<Dependency> mulePlugin2Dependencies = new TreeSet<>(buildDependencySet(INITIAL_NUMBER_DEPENDENCIES, null)); SortedMap<Dependency, SortedSet<Dependency>> mulePlugins = new TreeMap<>(); mulePlugins.put(mulePlugin1, mulePlugin1Dependencies); mulePlugins.put(mulePlugin2, mulePlugin2Dependencies); ClassLoaderModel model = new ClassLoaderModel(VERSION, buildArtifactCoordinates(MULE_APPLICATION_CLASSIFIER)); model.setMulePlugins(mulePlugins); SortedSet<Dependency> additionalMulePlugin2Dependencies = new TreeSet<>(buildDependencySet(ADDITIONAL_NUMBER_DEPENDENCIES, null)); model.addMulePlugin(mulePlugin2, additionalMulePlugin2Dependencies); Map<Dependency, Set<Dependency>> actualMulePlugins = model.getMulePlugins(); assertThat("Number of mule plugins in set is not the expected", actualMulePlugins.keySet().size(), equalTo(NUMBER_MULE_PLUGINS)); assertThat("Mule plugins set is not the expected", actualMulePlugins.keySet(), containsInAnyOrder(mulePlugin1, mulePlugin2)); assertThat("Number of dependencies of mulePlugin1 is not the expected", actualMulePlugins.get(mulePlugin1).size(), equalTo(ARBITRARY_NUMBER_DEPENDENCIES)); assertThat("Number of dependencies of mulePlugin2 is not the expected", actualMulePlugins.get(mulePlugin2).size(), equalTo(INITIAL_NUMBER_DEPENDENCIES + ADDITIONAL_NUMBER_DEPENDENCIES)); }