Package org.junit.runner

Examples of org.junit.runner.Description


    }

    public void testStateForClassesWithNoChildren()
        throws Exception
    {
        Description testDescription =
            Description.createSuiteDescription( "testMethod(cannot.be.loaded.by.junit.Test)" );
        Description st1 = Description.createSuiteDescription( STest1.class);
//        st1.addChild( Description.createSuiteDescription( STest1.class ) );
        testDescription.addChild( st1 );
        Description st2 = Description.createSuiteDescription( STest2.class);
  //      st2.addChild( Description.createSuiteDescription( STest2.class ) );
        testDescription.addChild( st2 );

        Map<String, TestSet> classMethodCounts = new HashMap<String, TestSet>();
        JUnitCoreRunListener listener = new JUnitCoreRunListener( new MockReporter(), classMethodCounts );
View Full Code Here


    public void testTestClassNotLoadableFromJUnitClassLoader()
        throws Exception
    {
        // can't use Description.createTestDescription() methods as these require a loaded Class
        Description testDescription =
            Description.createSuiteDescription( "testMethod(cannot.be.loaded.by.junit.Test)" );
        assertEquals( "testMethod", testDescription.getMethodName() );
        assertEquals( "cannot.be.loaded.by.junit.Test", testDescription.getClassName() );
        // assert that the test class is not visible by the JUnit classloader
        assertNull( testDescription.getTestClass() );
        Description suiteDescription = Description.createSuiteDescription( "testSuite" );
        suiteDescription.addChild( testDescription );
        Map<String, TestSet> classMethodCounts = new HashMap<String, TestSet>();
        JUnitCoreRunListener listener = new JUnitCoreRunListener( new MockReporter(), classMethodCounts );
        listener.testRunStarted( suiteDescription );
        assertEquals( 1, classMethodCounts.size() );
        TestSet testSet = classMethodCounts.get( "cannot.be.loaded.by.junit.Test" );
View Full Code Here

        throws Exception
    {
        final MockReporter reporter = new MockReporter();
        final RunListener jUnit4TestSetReporter = new JUnit4RunListener( reporter );
        final CountDownLatch countDownLatch = new CountDownLatch( 1 );
        final Description testSomething = Description.createTestDescription( STest1.class, "testSomething" );
        final Description testSomething2 = Description.createTestDescription( STest2.class, "testSomething2" );

        jUnit4TestSetReporter.testStarted( testSomething );

        new Thread( new Runnable()
        {
View Full Code Here

{
    @Test
    public void testGetAnnotatedIgnore()
    {
        JUnit4Reflector reflector = new JUnit4Reflector();
        Description desc = Description.createTestDescription( IgnoreWithDescription.class, "testSomething2" );
        Ignore annotatedIgnore = reflector.getAnnotatedIgnore( desc );
        Assert.assertNull( annotatedIgnore );
    }
View Full Code Here

        public void testFailure(Failure failure) throws Exception
        {
            Level level = this.logger.getLevel();

            this.logger.setLevel(Level.INFO);
            Description description = failure.getDescription();
            this.logger.info("[failed] " + description.getClassName() + "#" + description.getMethodName() +
                    " message: " + failure.getMessage());
            try
            {
                super.testFailure(failure);
            }
View Full Code Here

        KdcServer methodKdcServer = null;

        // Don't run the test if the @Ignored annotation is used
        if ( method.getAnnotation( Ignore.class ) != null )
        {
            Description description = describeChild( method );
            notifier.fireTestIgnored( description );
            return;
        }

        // Get the applyLdifs for each level
        Description suiteDescription = null;

        Description classDescription = getDescription();
        Description methodDescription = describeChild( method );

        // Before running any test, check to see if we must create a class DS
        // Get the LdapServerBuilder, if any
        CreateLdapServer methodLdapServerBuilder = methodDescription.getAnnotation( CreateLdapServer.class );
        CreateKdcServer methodKdcServerBuilder = methodDescription.getAnnotation( CreateKdcServer.class );

        // Ok, ready to run the test
        try
        {
            DirectoryService directoryService = null;
View Full Code Here

            return Description.createTestDescription(tc.getClass(), tc.getName(),
                    getAnnotations(tc));
        } else if (test instanceof TestSuite) {
            TestSuite ts = (TestSuite) test;
            String name = ts.getName() == null ? createSuiteDescription(ts) : ts.getName();
            Description description = Description.createSuiteDescription(name);
            int n = ts.testCount();
            for (int i = 0; i < n; i++) {
                Description made = makeDescription(ts.testAt(i));
                description.addChild(made);
            }
            return description;
        } else if (test instanceof Describable) {
            Describable adapter = (Describable) test;
View Full Code Here

    public Class<?> getTestClass() {
        return fNewTestClass;
    }

    public Description getDescription() {
        Description description = fRunner.getDescription();
        return removeIgnored(description);
    }
View Full Code Here

    private Description removeIgnored(Description description) {
        if (isIgnored(description)) {
            return Description.EMPTY;
        }
        Description result = description.childlessCopy();
        for (Description each : description.getChildren()) {
            Description child = removeIgnored(each);
            if (!child.isEmpty()) {
                result.addChild(child);
            }
        }
        return result;
    }
View Full Code Here

    // Implementation of Runner
    //

    @Override
    public Description getDescription() {
        Description description = Description.createSuiteDescription(getName(),
                getRunnerAnnotations());
        for (T child : getFilteredChildren()) {
            description.addChild(describeChild(child));
        }
        return description;
    }
View Full Code Here

TOP

Related Classes of org.junit.runner.Description

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.