Package org.junit.runner

Examples of org.junit.runner.Result.wasSuccessful()


      TestRunnerAdaptor adaptor = mock(TestRunnerAdaptor.class);
      when(adaptor.test(isA(TestMethodExecutor.class))).thenReturn(new TestResult(Status.PASSED));
     
      Result result = run(adaptor, ArquillianClass1.class);

      Assert.assertTrue(result.wasSuccessful());
      assertCycle(0, Cycle.values());
     
      verify(adaptor, times(1)).beforeSuite();
      verify(adaptor, times(1)).afterSuite();
   }
View Full Code Here


      TestRunnerAdaptor adaptor = mock(TestRunnerAdaptor.class);
      executeAllLifeCycles(adaptor);
     
      Result result = run(adaptor, ArquillianClass1.class);
     
      Assert.assertTrue(result.wasSuccessful());
      assertCycle(1, Cycle.values());

      verify(adaptor, times(1)).beforeSuite();
      verify(adaptor, times(1)).afterSuite();
   }
View Full Code Here

      executeAllLifeCycles(adaptor);
     
      throwException(Cycle.BEFORE_CLASS, new Throwable());
     
      Result result = run(adaptor, ArquillianClass1.class);
      Assert.assertFalse(result.wasSuccessful());
     
      assertCycle(1, Cycle.BEFORE_CLASS, Cycle.AFTER_CLASS);
      assertCycle(0, Cycle.BEFORE, Cycle.AFTER, Cycle.TEST);
  
      verify(adaptor, times(1)).beforeSuite();
View Full Code Here

      executeAllLifeCycles(adaptor);
     
      throwException(Cycle.BEFORE, new Throwable());
     
      Result result = run(adaptor, ArquillianClass1.class);
      Assert.assertFalse(result.wasSuccessful());
     
      assertCycle(1, Cycle.BEFORE_CLASS, Cycle.AFTER_CLASS, Cycle.BEFORE, Cycle.AFTER);
      assertCycle(0, Cycle.TEST);

      verify(adaptor, times(1)).beforeSuite();
View Full Code Here

   {
      TestRunnerAdaptor adaptor = mock(TestRunnerAdaptor.class);
      executeAllLifeCycles(adaptor);
     
      Result result = run(adaptor, ArquillianClass1.class, ArquillianClass1.class, ArquillianClass1.class, ArquillianClass1.class);
      Assert.assertTrue(result.wasSuccessful());

      verify(adaptor, times(1)).beforeSuite();
      verify(adaptor, times(1)).afterSuite();
   }
  
View Full Code Here

      executeAllLifeCycles(adaptor);
     
      throwException(Cycle.TEST, new Throwable());
     
      Result result = run(adaptor, ArquillianClass1.class);
      Assert.assertFalse(result.wasSuccessful());
     
      assertCycle(1, Cycle.values());
      verify(adaptor, times(1)).beforeSuite();
      verify(adaptor, times(1)).afterSuite();
View Full Code Here

      TestRunnerAdaptor adaptor = mock(TestRunnerAdaptor.class);
      doThrow(new Exception(exceptionMessage)).when(adaptor).beforeSuite();

      Result result = run(adaptor, ArquillianClass1.class, ArquillianClass1.class);
     
      Assert.assertFalse(result.wasSuccessful());
      // both should be marked failed, the second with the real exception as cause
      Assert.assertEquals(2, result.getFailureCount());
      Assert.assertEquals(exceptionMessage, result.getFailures().get(0).getMessage());
      Assert.assertEquals(exceptionMessage, result.getFailures().get(1).getException().getCause().getMessage());
     
View Full Code Here

               {
                  runOrder.add(description.getMethodName());
               }
            }, OrderedTestCase.class);

      Assert.assertTrue(result.wasSuccessful());

      Assert.assertEquals("one", runOrder.get(0));
      Assert.assertEquals("two", runOrder.get(1));
      Assert.assertEquals("tree", runOrder.get(2));
   }
View Full Code Here

               {
                  runOrder.add(description.getMethodName());
               }
            }, UnOrderedTestCase.class);

      Assert.assertTrue(result.wasSuccessful());

      List<Method> filteredMethods = new ArrayList<Method>();
      filteredMethods.addAll(Arrays.asList(UnOrderedTestCase.class.getMethods()));
      // Remove method not belonging to UnOrderedTestCase.class
      for(int i = 0; i < filteredMethods.size(); i++)
View Full Code Here

    JUnitCore junit = new JUnitCore();
    junit.addListener(new TextListener(System.out));
    Result result = junit.run(classes);

    return result.wasSuccessful() ? 0 : 1;
  }

}
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.