Package junit.framework

Examples of junit.framework.TestResult.wasSuccessful()


      {
         args = runner.preProcessCommandLine(args);

      TestResult r = runner.start(args);

      if (!r.wasSuccessful())
         {
        System.exit(FAILURE_EXIT);
         }
      System.exit(SUCCESS_EXIT);
    }
View Full Code Here


        
         resultFormatter.endTestSuite(dummyJUnit);

         writer.close();

         return result.wasSuccessful();
      }
      catch (Exception e)
      {
         if (isDebug)
            e.printStackTrace();
View Full Code Here

        // } catch (java.lang.InternalError e1){
        // System.out.println("Error with class "+n+" "+e1);
        // }
        //System.out.println("------------");
        // --
        System.exit(result.wasSuccessful() ? 0 : 1); // this is needed because the test may start the AWT EventQueue thread which is not a daemon.
    }

    /**
     * An overridable method that initializes the logging for the unit test run,
     * using the properties file passed in as the second argument.
View Full Code Here

            } catch (IllegalAccessException e) {
                tr.addError(theClazz, e);
            } catch (IllegalArgumentException e) {
                tr.addError(theClazz, e);
            }
            if ( !tr.wasSuccessful() ){
                sresult.setSuccessful(false);
                StringBuilder buf = new StringBuilder();
                StringBuilder buftrace = new StringBuilder();
                Enumeration<TestFailure> en;
                if (getAppendError()) {
View Full Code Here

        TestSetup wrapper = new TestSetup(test);

        TestResult result = new TestResult();
        wrapper.run(result);
        assertTrue(!result.wasSuccessful());
    }

    public void testRunningErrorsInTestSetup() {
        TestCase failure = new TestCase("failure") {
            @Override
View Full Code Here

        TestResult result = new TestResult();
        wrapper.run(result);

        assertTrue(!test.fWasRun);
        assertTrue(!result.wasSuccessful());
    }
}
View Full Code Here

    public void testNoException() {
        TestResult result = new TestResult();
        junit.framework.Test adapter = new JUnit4TestAdapter(NoExceptionTest.class);
        adapter.run(result);
        assertFalse(result.wasSuccessful());
    }

    public static class ExpectedTest {
        @Test(expected = Exception.class)
        public void expected() throws Exception {
View Full Code Here

    public void testExpected() {
        TestResult result = new TestResult();
        junit.framework.Test adapter = new JUnit4TestAdapter(ExpectedTest.class);
        adapter.run(result);
        assertTrue(result.wasSuccessful());
    }

    public static class UnExpectedExceptionTest {
        @Test(expected = Exception.class)
        public void expected() throws Exception {
View Full Code Here

                    }
                }
        ));
        try {
            TestResult result = junit.textui.TestRunner.run(new TestSuite());
            assertTrue(result.wasSuccessful());
        } finally {
            System.setOut(oldOut);
        }
    }
View Full Code Here

            TestResult tr = new TestResult();
            tr.addListener(new ResultListener(report));
            test.run(tr);
            m_results.add(tr);

            if (tr.wasSuccessful()) {
                System.out.println("Tests run: "
                        + tr.runCount()
                        + ", Failures: "
                        + tr.failureCount()
                        + ", Errors: "
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.