コード例 #1
0
  @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));
    }
  }
コード例 #2
0
 @Test
 public void testResolveAndGetFilesWithMissingDependenciesShouldThrowResolveException()
     throws IOException, ParseException {
   ModuleDescriptor moduleDescriptor = createAnonymousModuleDescriptor();
   prepareTestsThatRetrieveDependencies(moduleDescriptor);
   Exception failure = new Exception("broken");
   prepareResolveReportWithError(failure);
   ResolvedConfiguration configuration = ivyDependencyResolver.resolve(configurationStub);
   context.checking(
       new Expectations() {
         {
           allowing(configurationStub).getAllDependencies();
         }
       });
   try {
     configuration.getFiles(Specs.SATISFIES_ALL);
     fail();
   } catch (ResolveException e) {
     assertThat(
         e.getMessage(), startsWith("Could not resolve all dependencies for <configuration>"));
     assertThat(e.getCause(), sameInstance((Throwable) failure));
   }
 }