org.testng.junit
Class JUnitUtils.JUnitTestClass

java.lang.Object
  extended by org.testng.junit.JUnitUtils.JUnitTestClass
All Implemented Interfaces:
java.io.Serializable, IClass, ITestClass
Enclosing class:
JUnitUtils

public static class JUnitUtils.JUnitTestClass
extends java.lang.Object
implements ITestClass

An ITestClass implementation for test methods in JUnit.

Author:
Alexandru Popescu
See Also:
Serialized Form

Constructor Summary
JUnitUtils.JUnitTestClass(junit.framework.Test test)
           
 
Method Summary
 void addInstance(java.lang.Object instance)
           
 ITestNGMethod[] getAfterClassMethods()
          Returns all the methods that should be invoked after all the tests have been run on this class.
 ITestNGMethod[] getAfterGroupsMethods()
          Returns all @Configuration methods that should be invoked after certain groups.
 ITestNGMethod[] getAfterSuiteMethods()
          Returns all the methods that should be invoked after the suite has run.
 ITestNGMethod[] getAfterTestConfigurationMethods()
          Returns all @Configuration methods that should be invoked last before any others in the current test.
 ITestNGMethod[] getAfterTestMethods()
          Returns all the methods that should be invoked after a test method completes.
 ITestNGMethod[] getBeforeClassMethods()
          Return all the methods that should be invoked after the test class has been created and before any of its test methods is invoked.
 ITestNGMethod[] getBeforeGroupsMethods()
          Returns all @Configuration methods that should be invoked before certain groups.
 ITestNGMethod[] getBeforeSuiteMethods()
          Returns All the methods that should be invoked before the suite is run.
 ITestNGMethod[] getBeforeTestConfigurationMethods()
          Returns all @Configuration methods that should be invoked before any others in the current test.
 ITestNGMethod[] getBeforeTestMethods()
          Returns all the methods that should be invoked before a test method is invoked.
 int getInstanceCount()
           
 long[] getInstanceHashCodes()
          TODO cquezel JavaDoc.
 java.lang.Object[] getInstances(boolean reuse)
          Returns all the instances the methods will be invoked upon.
 java.lang.String getName()
           
 java.lang.Class getRealClass()
           
 ITestNGMethod[] getTestMethods()
          Returns all the applicable test methods.
 java.lang.String getTestName()
          If this class implements ITest, returns its test name, otherwise returns null.
 XmlClass getXmlClass()
           
 XmlTest getXmlTest()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JUnitUtils.JUnitTestClass

public JUnitUtils.JUnitTestClass(junit.framework.Test test)
Method Detail

getInstanceCount

public int getInstanceCount()
Specified by:
getInstanceCount in interface IClass
Specified by:
getInstanceCount in interface ITestClass
Returns:
The number of instances used in this class. This method is needed for serialization since we don't know ahead of time if the instances of the test classes will be serializable.
See Also:
ITestClass.getInstanceCount()

getInstanceHashCodes

public long[] getInstanceHashCodes()
Description copied from interface: ITestClass
TODO cquezel JavaDoc.

Specified by:
getInstanceHashCodes in interface IClass
Specified by:
getInstanceHashCodes in interface ITestClass
See Also:
ITestClass.getInstanceHashCodes()

getInstances

public java.lang.Object[] getInstances(boolean reuse)
Description copied from interface: ITestClass
Returns all the instances the methods will be invoked upon. This will typically be an array of one object in the absence of a @Factory annotation.

Specified by:
getInstances in interface IClass
Specified by:
getInstances in interface ITestClass
Parameters:
reuse - flag if a new set of instances must be returned (if set to false)
Returns:
All the instances the methods will be invoked upon.

getTestMethods

public ITestNGMethod[] getTestMethods()
Description copied from interface: ITestClass
Returns all the applicable test methods.

Specified by:
getTestMethods in interface ITestClass
Returns:
All the applicable test methods.
See Also:
ITestClass.getTestMethods()

getAfterClassMethods

public ITestNGMethod[] getAfterClassMethods()
Description copied from interface: ITestClass
Returns all the methods that should be invoked after all the tests have been run on this class.

Specified by:
getAfterClassMethods in interface ITestClass
Returns:
All the methods that should be invoked after all the tests have been run on this class.
See Also:
ITestClass.getAfterClassMethods()

getAfterGroupsMethods

public ITestNGMethod[] getAfterGroupsMethods()
Description copied from interface: ITestClass
Returns all @Configuration methods that should be invoked after certain groups.

Specified by:
getAfterGroupsMethods in interface ITestClass
Returns:
all @Configuration methods that should be invoked after certain groups.
See Also:
ITestClass.getAfterGroupsMethods()

getAfterSuiteMethods

public ITestNGMethod[] getAfterSuiteMethods()
Description copied from interface: ITestClass
Returns all the methods that should be invoked after the suite has run.

Specified by:
getAfterSuiteMethods in interface ITestClass
Returns:
All the methods that should be invoked after the suite has run.
See Also:
ITestClass.getAfterSuiteMethods()

getAfterTestConfigurationMethods

public ITestNGMethod[] getAfterTestConfigurationMethods()
Description copied from interface: ITestClass
Returns all @Configuration methods that should be invoked last before any others in the current test.

Specified by:
getAfterTestConfigurationMethods in interface ITestClass
Returns:
all @Configuration methods that should be invoked last before any others in the current test.
See Also:
ITestClass.getAfterTestConfigurationMethods()

getAfterTestMethods

public ITestNGMethod[] getAfterTestMethods()
Description copied from interface: ITestClass
Returns all the methods that should be invoked after a test method completes.

Specified by:
getAfterTestMethods in interface ITestClass
Returns:
All the methods that should be invoked after a test method completes.
See Also:
ITestClass.getAfterTestMethods()

getBeforeClassMethods

public ITestNGMethod[] getBeforeClassMethods()
Description copied from interface: ITestClass
Return all the methods that should be invoked after the test class has been created and before any of its test methods is invoked.

Specified by:
getBeforeClassMethods in interface ITestClass
Returns:
All the methods that should be invoked after the test class has been created and before any of its test methods is invoked.
See Also:
ITestClass.getBeforeClassMethods()

getBeforeGroupsMethods

public ITestNGMethod[] getBeforeGroupsMethods()
Description copied from interface: ITestClass
Returns all @Configuration methods that should be invoked before certain groups.

Specified by:
getBeforeGroupsMethods in interface ITestClass
Returns:
all @Configuration methods that should be invoked before certain groups.
See Also:
ITestClass.getBeforeGroupsMethods()

getBeforeSuiteMethods

public ITestNGMethod[] getBeforeSuiteMethods()
Description copied from interface: ITestClass
Returns All the methods that should be invoked before the suite is run.

Specified by:
getBeforeSuiteMethods in interface ITestClass
Returns:
All the methods that should be invoked before the suite is run.
See Also:
ITestClass.getBeforeSuiteMethods()

getBeforeTestConfigurationMethods

public ITestNGMethod[] getBeforeTestConfigurationMethods()
Description copied from interface: ITestClass
Returns all @Configuration methods that should be invoked before any others in the current test.

Specified by:
getBeforeTestConfigurationMethods in interface ITestClass
Returns:
all @Configuration methods that should be invoked before any others in the current test.
See Also:
ITestClass.getBeforeTestConfigurationMethods()

getBeforeTestMethods

public ITestNGMethod[] getBeforeTestMethods()
Description copied from interface: ITestClass
Returns all the methods that should be invoked before a test method is invoked.

Specified by:
getBeforeTestMethods in interface ITestClass
Returns:
All the methods that should be invoked before a test method is invoked.
See Also:
ITestClass.getBeforeTestMethods()

addInstance

public void addInstance(java.lang.Object instance)
Specified by:
addInstance in interface IClass
See Also:
IClass.addInstance(java.lang.Object)

getName

public java.lang.String getName()
Specified by:
getName in interface IClass
Returns:
this test class name. This is the name of the corresponding Java class.
See Also:
IClass.getName()

getRealClass

public java.lang.Class getRealClass()
Specified by:
getRealClass in interface IClass
Returns:
the Java class corresponding to this IClass.
See Also:
IClass.getRealClass()

getTestName

public java.lang.String getTestName()
Description copied from interface: IClass
If this class implements ITest, returns its test name, otherwise returns null.

Specified by:
getTestName in interface IClass

getXmlTest

public XmlTest getXmlTest()
Specified by:
getXmlTest in interface IClass
Returns:
the <test> tag this class was found in.

getXmlClass

public XmlClass getXmlClass()
Specified by:
getXmlClass in interface IClass
Returns:
the *lt;class> tag this class was found in.


Copyright © 2011. All Rights Reserved.