protected Dependency getMainAndroidDependency(Dependency dependency1, Dependency dependency2) {
        if (!dependency1.isVirtual()
                && !dependency2.isVirtual()
                && Ecosystem.JAVA.equals(dependency1.getEcosystem())
                && Ecosystem.JAVA.equals(dependency2.getEcosystem())) {
            final String name1 = dependency1.getActualFile().getName();
            final String name2 = dependency2.getActualFile().getName();
            if ("classes.jar".equals(name2)
                    && "aar".equals(FileUtils.getFileExtension(name1))
                    && dependency2.getFileName().contains(name1)) {
                return dependency1;
            }
            if ("classes.jar".equals(name1)
                    && "aar".equals(FileUtils.getFileExtension(name2))
                    && dependency1.getFileName().contains(name2)) {
                return dependency2;
            }
        }
        return null;
    }
@Test
    public void testGetMainAndroidDependency() throws Exception {
        ArchiveAnalyzer aa = null;
        try (Engine engine = new Engine(Engine.Mode.EVIDENCE_COLLECTION, getSettings())) {
            Dependency dependency1 = new Dependency(BaseTest.getResourceAsFile(this, "aar-1.0.0.aar"));
            dependency1.setEcosystem(Ecosystem.JAVA);
            aa = new ArchiveAnalyzer();

            aa.initialize(getSettings());
            aa.accept(dependency1.getActualFile());
            aa.prepareAnalyzer(engine);
            aa.analyze(dependency1, engine);

            Dependency dependency2 = null;
            for (Dependency d : engine.getDependencies()) {
                if ("classes.jar".equals(d.getActualFile().getName())) {
                    dependency2 = d;
                    break;
                }
            }
            assertNotNull("classes.jar was not found", dependency2);
            dependency2.setEcosystem(Ecosystem.JAVA);
            DependencyMergingAnalyzer instance = new DependencyMergingAnalyzer();
            Dependency expResult = dependency1;
            Dependency result = instance.getMainAndroidDependency(dependency1, dependency2);
            assertEquals(expResult, result);
        } finally {
            if (aa != null) {
                aa.closeAnalyzer();
            }
        }
    }