Package junit.framework

Examples of junit.framework.TestResult


    }

    @Test
    public void generatedErrorTestsMatchUp() {
        junit.framework.Test shouldFail = fAdapter.getTests().get(0);
        TestResult result = new TestResult();
        ErrorRememberingListener listener = new ErrorRememberingListener();
        result.addListener(listener);
        fAdapter.run(result);
        assertNotNull(listener.getError());
        assertTrue(shouldFail == listener.getError());
    }
View Full Code Here


        }
    }

    public void testCompatibility() {
        fLog = "";
        TestResult result = new TestResult();
        junit.framework.Test adapter = new JUnit4TestAdapter(NewTest.class);
        adapter.run(result);
        assertEquals("before test after ", fLog);
    }
View Full Code Here

            throw exception;
        }
    }

    public void testException() {
        TestResult result = new TestResult();
        junit.framework.Test adapter = new JUnit4TestAdapter(ErrorTest.class);
        adapter.run(result);
        assertEquals(exception, result.errors().nextElement().thrownException());
    }
View Full Code Here

        assertEquals(exception, result.errors().nextElement().thrownException());
    }

    public void testNotifyResult() {
        JUnit4TestAdapter adapter = new JUnit4TestAdapter(ErrorTest.class);
        TestResult result = new TestResult();
        final StringBuffer log = new StringBuffer();
        result.addListener(new TestListener() {

            public void startTest(junit.framework.Test test) {
                log.append(" start ").append(test);
            }
View Full Code Here

        public void succeed() throws Exception {
        }
    }

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

            throw new Exception();
        }
    }

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

        }
    }

    public void testBeforeAndAfterClass() {
        log = "";
        TestResult result = new TestResult();
        junit.framework.Test adapter = new JUnit4TestAdapter(BeforeClassTest.class);
        adapter.run(result);
        assertEquals("before class before test after before test after after class ", log);
    }
View Full Code Here

        public void nothing() {
        }
    }

    public void testExceptionInBefore() {
        TestResult result = new TestResult();
        junit.framework.Test adapter = new JUnit4TestAdapter(ExceptionInBeforeTest.class);
        adapter.run(result);
        assertEquals(1, result.errorCount());
    }
View Full Code Here

        public void aTest() {
        }
    }

    public void testInvalidMethod() {
        TestResult result = new TestResult();
        junit.framework.Test adapter = new JUnit4TestAdapter(InvalidMethodTest.class);
        adapter.run(result);
        assertEquals(1, result.errorCount());
        TestFailure failure = result.errors().nextElement();
        assertTrue(failure.exceptionMessage().contains("Method shouldBeStatic() should be static"));
    }
View Full Code Here

    public static class NoTests {
    }

    public void testRunWithClass() {
        wasRun = false;
        TestResult result = new TestResult();
        junit.framework.Test adapter = new JUnit4TestAdapter(NoTests.class);
        adapter.run(result);
        assertTrue(wasRun);
    }
View Full Code Here

TOP

Related Classes of junit.framework.TestResult

Copyright © 2018 www.massapicom. 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.