public Collection<PluginUpdateAggregate> aggregate(@Nullable Collection<PluginUpdate> pluginUpdates) {
    if (pluginUpdates == null || pluginUpdates.isEmpty()) {
      return Collections.emptyList();
    }

    Map<Plugin, PluginUpdateAggregateBuilder> builders = new HashMap<>();
    for (PluginUpdate pluginUpdate : pluginUpdates) {
      Plugin plugin = pluginUpdate.getPlugin();
      PluginUpdateAggregateBuilder builder = builders.get(plugin);
      if (builder == null) {
        builder = PluginUpdateAggregateBuilder.builderFor(plugin);
        builders.put(plugin, builder);
      }
      builder.add(pluginUpdate);
    }

    return Lists.newArrayList(transform(builders.values(), PluginUpdateAggregateBuilder::build));
  }
@Test
  public void aggregate_put_pluginUpdates_with_same_plugin_in_the_same_PluginUpdateAggregate() {
    PluginUpdate pluginUpdate1 = createPluginUpdate("key1");
    PluginUpdate pluginUpdate2 = createPluginUpdate("key1");
    PluginUpdate pluginUpdate3 = createPluginUpdate("key1");
    Collection<PluginUpdateAggregator.PluginUpdateAggregate> aggregates = underTest.aggregate(ImmutableList.of(
      pluginUpdate1,
      pluginUpdate2,
      pluginUpdate3));

    assertThat(aggregates).hasSize(1);
    Collection<PluginUpdate> releases = aggregates.iterator().next().getUpdates();
    assertThat(releases)
      .hasSize(3)
      .contains(pluginUpdate1)
      .contains(pluginUpdate2)
      .contains(pluginUpdate3);
  }