Exemplo n.º 1
0
 public void testExecuteWithUnspecifiedTestResultsDir() {
   setUpMocks(test);
   test.setTestResultsDir(null);
   try {
     test.execute();
     fail();
   } catch (Exception e) {
     assertThat(e.getCause(), Matchers.instanceOf(InvalidUserDataException.class));
   }
 }
Exemplo n.º 2
0
  @org.junit.Test
  public void testExecuteWithNonExistingCompiledTestsDir() {
    setUpMocks(test);
    test.setUnmanagedClasspath(null);
    context.checking(
        new Expectations() {
          {
            allowing(existentDirsFilterMock)
                .checkExistenceAndThrowStopActionIfNot(TEST_TEST_CLASSES_DIR);
            will(throwException(new StopActionException()));
          }
        });
    test.existingDirsFilter = existentDirsFilterMock;

    test.execute();
  }
Exemplo n.º 3
0
 @org.junit.Test(expected = GradleException.class)
 public void testExecuteWithTestFailuresAndStopAtFailures() {
   setUpMocks(test);
   setExistingDirsFilter();
   context.checking(
       new Expectations() {
         {
           one(testFrameworkMock).prepare(getProject(), test);
           one(testFrameworkMock).getTestClassNames();
           will(returnValue(okTestClassNames));
           one(testFrameworkMock)
               .execute(getProject(), test, okTestClassNames, new ArrayList<String>());
         }
       });
   test.execute();
 }
Exemplo n.º 4
0
 @org.junit.Test
 public void testExecuteWithTestFailuresAndContinueWithFailures() {
   setUpMocks(test);
   setExistingDirsFilter();
   test.setStopAtFailuresOrErrors(false);
   context.checking(
       new Expectations() {
         {
           one(testFrameworkMock).prepare(getProject(), test);
           one(testFrameworkMock).getTestClassNames();
           will(returnValue(okTestClassNames));
           one(testFrameworkMock)
               .execute(getProject(), test, okTestClassNames, new ArrayList<String>());
           one(testFrameworkMock).report(getProject(), test);
         }
       });
   test.execute();
 }