public void beforeExecute(Task task) {
      assertThat(current, nullValue());
      assertTrue(planned.contains(task));
      current = task;

      String taskPath = path(task);
      if (taskPath.startsWith(":buildSrc:")) {
        return;
      }

      executedTasks.add(taskPath);
    }
  @Test
  public void delegatesDidWork() {
    context.checking(
        new Expectations() {
          {
            allowing(delegate).getDidWork();
            will(onConsecutiveCalls(returnValue(true), returnValue(false)));
          }
        });

    assertTrue(visitor.getDidWork());
    assertFalse(visitor.getDidWork());
  }
  @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 void assertCanExecute() {
   assertNull(getExecutable());
   assertTrue(getEnvironmentVars().isEmpty());
 }