ApplicationDependencyResolver { @Deprecated public List<BundleDependency> resolveApplicationDependencies(File pomFile) { return resolveApplicationDependencies(pomFile, false, empty()); } ApplicationDependencyResolver(AetherMavenClient muleMavenPluginClient); @Deprecated List<BundleDependency> resolveApplicationDependencies(File pomFile); @Deprecated List<BundleDependency> resolveApplicationDependencies(File pomFile, boolean includeTestDependencies); List<BundleDependency> resolveApplicationDependencies(File pomFile, boolean includeTestDependencies,
                                                               Optional<MavenReactorResolver> mavenReactorResolver);  }
@Test public void emptyDependencies() { when(mockMavenClient.resolveArtifactDependencies(any(), anyBoolean(), anyBoolean(), any(), any(), any())) .thenReturn(emptyList()); ApplicationDependencyResolver applicationDependencyResolver = new ApplicationDependencyResolver(mockMavenClient); List<BundleDependency> bundleDependencies = applicationDependencyResolver.resolveApplicationDependencies(new File("not-relevant")); assertThat(bundleDependencies, empty()); }
@Test public void filterProvidedDependencies() { BundleDependency mockProvidedDependency = mock(BundleDependency.class, RETURNS_DEEP_STUBS); BundleDependency mockNonProvidedDependency = mock(BundleDependency.class, RETURNS_DEEP_STUBS); BundleDependency mockDomainDependency = mock(BundleDependency.class, RETURNS_DEEP_STUBS); when(mockProvidedDependency.getScope()).thenReturn(PROVIDED); when(mockNonProvidedDependency.getScope()).thenReturn(BundleScope.COMPILE); when(mockDomainDependency.getScope()).thenReturn(BundleScope.COMPILE); when(mockDomainDependency.getDescriptor().getClassifier()).thenReturn(Optional.of(MULE_DOMAIN_CLASSIFIER)); when(mockMavenClient.resolveArtifactDependencies(any(), anyBoolean(), anyBoolean(), any(), any(), any())) .thenReturn(ImmutableList.of()); ApplicationDependencyResolver applicationDependencyResolver = new ApplicationDependencyResolver(mockMavenClient); List<BundleDependency> bundleDependencies = applicationDependencyResolver.resolveApplicationDependencies(new File("not-relevant")); assertThat(bundleDependencies, empty()); }