patterntesting.runtime.junit.internal
Class DescriptionUtils

Package class diagram package DescriptionUtils
java.lang.Object
  extended by patterntesting.runtime.junit.internal.DescriptionUtils

public class DescriptionUtils
extends Object

This class provides some utiltis for the Description class for older versions of JUnit 4. In newer versions we have some more methods to use but because we want to support also JUnit 4.4 we provide the missing methods here.

Since:
1.2.20 (19.04.2012)
Author:
oliver

Method Summary
static org.junit.runner.Description createTestDescription(org.junit.runner.Description description, Annotation[] annotations)
          Creates the test description.
static String getMethodNameOf(org.junit.runner.Description description)
          Gets the method name the given description.
static Class<?> getTestClassOf(org.junit.runner.Description description)
          Here we extract the test class from the given descripiton.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getTestClassOf

@MayReturnNull
public static Class<?> getTestClassOf(org.junit.runner.Description description)
Here we extract the test class from the given descripiton. In JUnit 4.4 we don't have the Description does not have a method getTestClass(). We cannot provide our own "Description44" subclass of it because it is not designed for subclassing (no public constructor). Se we (re)implement the missing features for the SmokeFilter here.

Parameters:
description - the description
Returns:
the test class from
Since:
1.2.20

getMethodNameOf

@MayReturnNull
public static String getMethodNameOf(org.junit.runner.Description description)
Gets the method name the given description. This method is needed for JUnit 4.5 and older. In JUnit 4.6 and newer there is a getMethodName() available in the Description class.

Parameters:
description - the description
Returns:
the method name of

createTestDescription

public static org.junit.runner.Description createTestDescription(org.junit.runner.Description description,
                                                                 Annotation[] annotations)
Creates the test description.

Parameters:
description - the description
annotations - the annotations
Returns:
the description


Copyright © 2002–2014 PatternTesting Team. All rights reserved.