public ImmutableList<PluginMatchingResult<VulnDetector>> getVulnDetectors(
      ReconnaissanceReport reconnaissanceReport) {
    return tsunamiPlugins.entrySet().stream()
        .filter(entry -> isVulnDetector(entry.getKey()))
        .map(entry -> matchAllVulnDetectors(entry.getKey(), entry.getValue(), reconnaissanceReport))
        .flatMap(Streams::stream)
        .collect(toImmutableList());
  }
@Test
  public void
      getVulnDetectors_whenRemoteDetectorOsFilterHasMatchingService_returnsMatchedService() {
    NetworkService wordPressService =
        NetworkService.newBuilder()
            .setNetworkEndpoint(NetworkEndpointUtils.forIpAndPort("1.1.1.1", 80))
            .setTransportProtocol(TransportProtocol.TCP)
            .setServiceName("http")
            .setSoftware(Software.newBuilder().setName("WordPress"))
            .build();
    NetworkService jenkinsService =
        NetworkService.newBuilder()
            .setNetworkEndpoint(NetworkEndpointUtils.forIpAndPort("1.1.1.1", 443))
            .setTransportProtocol(TransportProtocol.TCP)
            .setServiceName("https")
            .setSoftware(Software.newBuilder().setName("Jenkins"))
            .build();
    NetworkService noNameService =
        NetworkService.newBuilder()
            .setNetworkEndpoint(NetworkEndpointUtils.forIpAndPort("1.1.1.1", 12345))
            .setTransportProtocol(TransportProtocol.TCP)
            .build();
    ReconnaissanceReport fakeReconnaissanceReport =
        ReconnaissanceReport.newBuilder()
            .setTargetInfo(
                TargetInfo.newBuilder()
                    .addOperatingSystemClasses(
                        OperatingSystemClass.newBuilder()
                            .setType("general purpose")
                            .setVendor("Vendor")
                            .setOsFamily("FakeOS")
                            .setAccuracy(96)))
            .addNetworkServices(wordPressService)
            .addNetworkServices(jenkinsService)
            .addNetworkServices(noNameService)
            .build();
    PluginManager pluginManager =
        Guice.createInjector(
                new FakePortScannerBootstrapModule(),
                new FakeServiceFingerprinterBootstrapModule(),
                FakeFilteringRemoteDetector.getModule())
            .getInstance(PluginManager.class);

    ImmutableList<PluginMatchingResult<VulnDetector>> vulnDetectors =
        pluginManager.getVulnDetectors(fakeReconnaissanceReport);

    assertThat(vulnDetectors).hasSize(1);
    ImmutableList<MatchedPlugin> matchedResult =
        ((FakeFilteringRemoteDetector) vulnDetectors.get(0).tsunamiPlugin()).getMatchedPlugins();
    assertThat(matchedResult).hasSize(4);
    assertThat(matchedResult.get(1).getPlugin())
        .isEqualTo(FakeFilteringRemoteDetector.getJenkinsServiceDefinition());
    assertThat(matchedResult.get(1).getServicesList())
        .containsExactly(jenkinsService, noNameService);

    // The other non-OS detector should match, too:
    assertThat(matchedResult.get(0).getPlugin())
        .isEqualTo(FakeFilteringRemoteDetector.getHttpServiceDefinition());
    // wordpress: matching service_name (http)
    // jenkins: mismatching service_name (http*s*)
    // nonameservice: no service_name present in the NetworkService, hasMatchingServiceName accepts
    // that
    assertThat(matchedResult.get(0).getServicesList())
        .containsExactly(wordPressService, noNameService);

    // The one that matches the OS only, should match everything:
    assertThat(matchedResult.get(2).getPlugin())
        .isEqualTo(FakeFilteringRemoteDetector.getOperatingSystemServiceDefinition());
    assertThat(matchedResult.get(2).getServicesList())
        .containsExactly(wordPressService, jenkinsService, noNameService);

    // The one that matches the OS and "http", should return these:
    assertThat(matchedResult.get(3).getPlugin())
        .isEqualTo(FakeFilteringRemoteDetector.getOperatingSystemAndHttpServiceDefinition());
    assertThat(matchedResult.get(3).getServicesList())
        .containsExactly(wordPressService, noNameService);
  }