@Test public void testResolveAndRethrowFailureWithNoMissingDependenciesShouldDoNothing() throws IOException, ParseException { ModuleDescriptor moduleDescriptor = createAnonymousModuleDescriptor(); prepareTestsThatRetrieveDependencies(moduleDescriptor); prepareResolveReport(); ResolvedConfiguration configuration = ivyDependencyResolver.resolve(configurationStub); assertFalse(configuration.hasError()); configuration.rethrowFailure(); }
@Test public void testResolveAndRethrowFailureWithMissingDependenciesShouldThrowResolveException() throws IOException, ParseException { ModuleDescriptor moduleDescriptor = createAnonymousModuleDescriptor(); prepareTestsThatRetrieveDependencies(moduleDescriptor); Exception failure = new Exception("broken"); prepareResolveReportWithError(failure); ResolvedConfiguration configuration = ivyDependencyResolver.resolve(configurationStub); assertTrue(configuration.hasError()); try { configuration.rethrowFailure(); fail(); } catch (ResolveException e) { assertThat( e.getMessage(), startsWith("Could not resolve all dependencies for <configuration>")); assertThat(e.getCause(), sameInstance((Throwable) failure)); } }
public boolean hasError() { return resolvedConfiguration.hasError(); }