@Override
    public void analyzeDependency(Dependency dependency, Engine engine) throws AnalysisException {
        final List<ClassNameInformation> classNames = collectClassNames(dependency);
        final String fileName = dependency.getFileName().toLowerCase();
        if ((classNames.isEmpty()
                && (fileName.endsWith("-sources.jar")
                || fileName.endsWith("-javadoc.jar")
                || fileName.endsWith("-src.jar")
                || fileName.endsWith("-doc.jar")
                || isMacOSMetaDataFile(dependency, engine)))
                || !isZipFile(dependency)) {
            engine.removeDependency(dependency);
            return;
        }
        Exception exception = null;
        boolean hasManifest = false;
        try {
            hasManifest = parseManifest(dependency, classNames);
        } catch (IOException ex) {
            LOGGER.debug("Invalid Manifest", ex);
            exception = ex;
        }
        boolean hasPOM = false;
        try {
            hasPOM = analyzePOM(dependency, classNames, engine);
        } catch (AnalysisException ex) {
            LOGGER.debug("Error parsing pom.xml", ex);
            exception = ex;
        }
        final boolean addPackagesAsEvidence = !(hasManifest && hasPOM);
        analyzePackageNames(classNames, dependency, addPackagesAsEvidence);
        dependency.setEcosystem(DEPENDENCY_ECOSYSTEM);

        if (exception != null) {
            throw new AnalysisException(String.format("An error occurred extracting evidence from "
                    + "%s, analysis may be incomplete; please see the log for more details.",
                    dependency.getDisplayFileName()), exception);
        }
    }
@Test
    public void testAnalyseDependency_SkipsNonZipFile() throws Exception {
        JarAnalyzer instance = new JarAnalyzer();
        Dependency textFileWithJarExtension = new Dependency();
        textFileWithJarExtension
                .setActualFilePath(BaseTest.getResourceAsFile(this, "test.properties").getAbsolutePath());
        textFileWithJarExtension.setFileName("textFileWithJarExtension.jar");
        try (Engine engine = new Engine(getSettings())) {
            engine.setDependencies(Collections.singletonList(textFileWithJarExtension));
            instance.analyzeDependency(textFileWithJarExtension, engine);
            assertEquals(0, engine.getDependencies().length);
        }
    }