Package org.junit.runner

Examples of org.junit.runner.Description


    notifier.fireTestFinished(description);
  }

  @Override
  public Description getDescription() {
    Description spec= Description.createSuiteDescription(getName());
    List<Method> testMethods= fTestMethods;
    for (Method method : testMethods)
        spec.addChild(methodDescription(method));
    return spec;
  }
View Full Code Here


  }

  @Test
  public void plansNamedCorrectly() throws Exception {
    Runner runner= Request.aClass(FibonacciTest.class).getRunner();
    Description description= runner.getDescription();
    assertEquals("[0]", description.getChildren().get(0).getDisplayName());
  }
View Full Code Here

    run= false;   
    JUnitCore core= new JUnitCore();
    Result result= core.run(ErrorInBeforeClass.class);
    assertFalse(run);
    assertEquals(1, result.getFailureCount());
    Description description= result.getFailures().get(0).getDescription();
    assertEquals(ErrorInBeforeClass.class.getName(), description.getDisplayName());
  }
View Full Code Here

  @Test
  public void failedConstructionIsTestFailure() {
    Result result= JUnitCore.runClasses(CantConstruct.class);
    Failure failure= result.getFailures().get(0);
    Description expected= Description.createTestDescription(CantConstruct.class, "foo");
    Assert.assertEquals(expected, failure.getDescription());
  }
View Full Code Here

  @Test public void eliminateUnnecessaryTreeBranches() throws Exception {
    Runner runner = Request.aClass(OneTwoSuite.class).filterWith(
        Description.createTestDescription(TestOne.class, "a"))
        .getRunner();
    Description description = runner.getDescription();
    assertEquals(1, description.getChildren().size());
  }
View Full Code Here

    assertEquals(childless.hashCode(), anotherChildless.hashCode());
    assertFalse(childless.hashCode() == namedB.hashCode());
  }
 
  private Description descriptionWithTwoKids(String first, String second) {
    Description twoKids = Description.createSuiteDescription("a");
    twoKids.addChild(Description.createTestDescription(getClass(), first));
    twoKids.addChild(Description.createTestDescription(getClass(), second));
    return twoKids;
  }
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 runs.isEmpty() ? null : new Suite( null, runs ) {};
        }

        private boolean hasChildren( Runner runner )
        {
            Description description = runner.getDescription();
            Collection children = description == null ? null : description.getChildren();
            return children != null && !children.isEmpty();
        }
View Full Code Here

    {
        String name = extractClassName( description );
        if ( name == null || isInsaneJunitNullString( name ) )
        {
            // This can happen upon early failures (class instantiation error etc)
            Description subDescription = description.getChildren().get( 0 );
            if ( subDescription != null )
            {
                name = extractClassName( subDescription );
            }
            if ( name == null )
View Full Code Here

    {
        JUnit4Reflector reflector = new JUnit4Reflector();
        final Method testSomething2 =
            ReflectionUtils.getMethod( IgnoreWithDescription.class, "testSomething2", EMPTY_CLASS_ARRAY );
        final Annotation[] annotations = testSomething2.getAnnotations();
        Description desc =
            Description.createTestDescription( IgnoreWithDescription.class, "testSomething2", annotations );
        Ignore annotatedIgnore = reflector.getAnnotatedIgnore( desc );
        Assert.assertEquals( reason, annotatedIgnore.value() );
    }
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.