@Override
    protected void analyzeDependency(Dependency dependency, Engine engine) throws AnalysisException {

        final Set<Evidence> remove;
        if (dependency.getVersion() != null) {
            remove = dependency.getEvidence(EvidenceType.VERSION).stream()
                    .filter(e -> !e.isFromHint() && !dependency.getVersion().equals(e.getValue()))
                    .collect(Collectors.toSet());
        } else {
            remove = new HashSet<>();
            String fileVersion = null;
            String pomVersion = null;
            String manifestVersion = null;
            for (Evidence e : dependency.getEvidence(EvidenceType.VERSION)) {
                if (FILE.equals(e.getSource()) && VERSION.equals(e.getName())) {
                    fileVersion = e.getValue();
                } else if ((NEXUS.equals(e.getSource()) || CENTRAL.equals(e.getSource())
                        || POM.equals(e.getSource())) && VERSION.equals(e.getName())) {
                    pomVersion = e.getValue();
                } else if (MANIFEST.equals(e.getSource()) && IMPLEMENTATION_VERSION.equals(e.getName())) {
                    manifestVersion = e.getValue();
                }
            }
            //ensure we have at least two not null
            if (((fileVersion == null ? 0 : 1) + (pomVersion == null ? 0 : 1) + (manifestVersion == null ? 0 : 1)) > 1) {
                final DependencyVersion dvFile = new DependencyVersion(fileVersion);
                final DependencyVersion dvPom = new DependencyVersion(pomVersion);
                final DependencyVersion dvManifest = new DependencyVersion(manifestVersion);
                final boolean fileMatch = Objects.equals(dvFile, dvPom) || Objects.equals(dvFile, dvManifest);
                final boolean manifestMatch = Objects.equals(dvManifest, dvPom) || Objects.equals(dvManifest, dvFile);
                final boolean pomMatch = Objects.equals(dvPom, dvFile) || Objects.equals(dvPom, dvManifest);
                if (fileMatch || manifestMatch || pomMatch) {
                    LOGGER.debug("filtering evidence from {}", dependency.getFileName());

                    for (Evidence e : dependency.getEvidence(EvidenceType.VERSION)) {
                        if (!e.isFromHint()
                                && !(pomMatch && VERSION.equals(e.getName())
                                && (NEXUS.equals(e.getSource()) || CENTRAL.equals(e.getSource()) || POM.equals(e.getSource())))
                                && !(fileMatch && VERSION.equals(e.getName()) && FILE.equals(e.getSource()))
                                && !(manifestMatch && MANIFEST.equals(e.getSource()) && IMPLEMENTATION_VERSION.equals(e.getName()))) {
                            remove.add(e);
                        }
                    }
                }
            }
        }
        remove.forEach((e) -> dependency.removeEvidence(EvidenceType.VERSION, e));

        if (dependency.getVersion() == null) {
            final Set<Evidence> evidence = dependency.getEvidence(EvidenceType.VERSION);
            final DependencyVersion version;
            final Evidence e = evidence.stream().findFirst().orElse(null);
            if (e != null) {
                version = DependencyVersionUtil.parseVersion(e.getValue(), true);
                if (version != null && evidence.stream()
                        .map(ev -> DependencyVersionUtil.parseVersion(ev.getValue(), true))
                        .allMatch(version::equals)) {
                    dependency.setVersion(version.toString());
                }
            }
        }
    }
@Test
    public void testAnalyzeDependencyFileManifest() throws Exception {
        Dependency dependency = new Dependency();

        dependency.addEvidence(EvidenceType.VERSION, "util", "version", "33.3", Confidence.HIGHEST);
        dependency.addEvidence(EvidenceType.VERSION, "other", "version", "alpha", Confidence.HIGHEST);
        dependency.addEvidence(EvidenceType.VERSION, "other", "Implementation-Version", "1.2.3", Confidence.HIGHEST);

        VersionFilterAnalyzer instance = new VersionFilterAnalyzer();
        instance.initialize(getSettings());

        instance.analyzeDependency(dependency, null);
        assertEquals(3,  dependency.getEvidence(EvidenceType.VERSION).size());

        dependency.addEvidence(EvidenceType.VERSION, "Manifest", "Implementation-Version", "1.2.3", Confidence.HIGHEST);

        instance.analyzeDependency(dependency, null);
        assertEquals(4,  dependency.getEvidence(EvidenceType.VERSION).size());

        dependency.addEvidence(EvidenceType.VERSION, "file", "version", "1.2.3", Confidence.HIGHEST);
        instance.analyzeDependency(dependency, null);
        assertEquals(2,  dependency.getEvidence(EvidenceType.VERSION).size());
    }