Exemple #1
0
 public void testExecuteWithUnspecifiedTestResultsDir() {
   setUpMocks(test);
   test.setTestResultsDir(null);
   try {
     test.execute();
     fail();
   } catch (Exception e) {
     assertThat(e.getCause(), Matchers.instanceOf(InvalidUserDataException.class));
   }
 }
Exemple #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();
  }
Exemple #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();
 }
Exemple #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();
 }