@Override
  public ProtobufSystemInfo.Section toProtobuf() {
    ProtobufSystemInfo.Section.Builder protobuf = ProtobufSystemInfo.Section.newBuilder();
    protobuf.setName("Plugins");

    for (PluginInfo plugin : repository.getPluginsInfoByType(PluginType.EXTERNAL)) {
      String label = "";
      Version version = plugin.getVersion();
      if (version != null) {
        label = version.getName() + " ";
      }
      label += String.format("[%s]", plugin.getName());

      setAttribute(protobuf, plugin.getKey(), label);
    }
    return protobuf.build();
  }
@Test
  public void plugin_name_and_version() {
    when(repo.getPluginsInfoByType(PluginType.EXTERNAL)).thenReturn(Arrays.asList(
      new PluginInfo("key-1")
        .setName("Plugin 1")
        .setVersion(Version.create("1.1")),
      new PluginInfo("key-2")
        .setName("Plugin 2")
        .setVersion(Version.create("2.2")),
      new PluginInfo("no-version")
        .setName("No Version")));

    ProtobufSystemInfo.Section section = underTest.toProtobuf();

    assertThatAttributeIs(section, "key-1", "1.1 [Plugin 1]");
    assertThatAttributeIs(section, "key-2", "2.2 [Plugin 2]");
    assertThatAttributeIs(section, "no-version", "[No Version]");
  }