Top Description Fields Constructors Methods
org.testng

pack-priv Class TestClass

extends NoOpTestClass
implements ITestClass, ITestClassConfigInfo, IObject
Class Inheritance
All Implemented Interfaces
org.testng.internal.IObject, org.testng.internal.ITestClassConfigInfo, org.testng.ITestClass, org.testng.IClass
Imports
java.util.ArrayList, .Arrays, .IdentityHashMap, .List, org.testng.collections.Lists, .Objects, org.testng.internal.*, org.testng.internal.annotations.IAnnotationFinder, org.testng.log4testng.Logger, org.testng.xml.XmlClass, .XmlTest

This class represents a test class: - The test methods - The configuration methods (test and method) - The class file

Field Summary

Modifier and TypeField and Description
private final IdentityHashMap<Object, List<ITestNGMethod>>
private IAnnotationFinder
private final IdentityHashMap<Object, List<ITestNGMethod>>
private IClass
private static final Logger
private final String
private final ITestObjectFactory
private ITestMethodFinder
private String
private XmlClass
private XmlTest
Inherited from org.testng.internal.NoOpTestClass:
m_afterClassMethodsm_afterGroupsMethodsm_afterSuiteMethodsm_afterTestConfMethodsm_afterTestMethodsm_beforeClassMethodsm_beforeGroupsMethodsm_beforeSuiteMethodsm_beforeTestConfMethodsm_beforeTestMethodsm_testClassm_testMethods

Constructor Summary

AccessConstructor and Description
protected
TestClass(ITestObjectFactory objectFactory, IClass cls, ITestMethodFinder testMethodFinder, IAnnotationFinder annotationFinder, XmlTest xmlTest, XmlClass xmlClass, String errorMsgPrefix)

Method Summary

Modifier and TypeMethod and Description
public void
addInstance(Object
- The instance to be added.
instance
)

Overrides org.testng.internal.NoOpTestClass.addInstance.

Implements org.testng.IClass.addInstance.

public void
addObject(IObject.IdentifiableObject
- The instance that should be added to the list of instances.
instance
)

Overrides org.testng.internal.NoOpTestClass.addObject.

Implements org.testng.internal.IObject.addObject.

private ITestNGMethod[]
createTestMethods(ITestNGMethod[] methods)

Create the test methods that belong to this class (rejects all those that belong to a different class).

protected void
dump()

public List<ITestNGMethod>
public List<ITestNGMethod>
private static List<ITestNGMethod>
public IAnnotationFinder
public IClass
public List<ITestNGMethod>
public List<ITestNGMethod>
getInstanceBeforeClassMethods(Object
object hashcode
instance
)

Implements org.testng.internal.ITestClassConfigInfo.getInstanceBeforeClassMethods.

Query the instance before class methods from config methods map.
public long[]
public Object[]
getInstances(boolean
flag if a new set of instances must be returned (if set to false)
create
)

Overrides org.testng.internal.NoOpTestClass.getInstances.

Implements org.testng.IClass.getInstances.

Returns all the instances the methods will be invoked upon.
public Object[]
getInstances(boolean
flag if a new set of instances must be returned (if set to false)
create
,
String
- Text that should be prefixed to the error message when there are issues. Can be empty.
errorMsgPrefix
)

Overrides default org.testng.IClass.getInstances.

Returns all the instances the methods will be invoked upon.
public IObject.IdentifiableObject[]
getObjects(boolean
- true if objects should be created before returning.
create
,
String
- Text that should be prefixed to the error message when there are issues. Can be empty.
errorMsgPrefix
)

Overrides org.testng.internal.NoOpTestClass.getObjects.

Implements org.testng.internal.IObject.getObjects.

Returns all the instances the methods will be invoked upon.
public ITestMethodFinder
public String
public XmlClass
public XmlTest
private void
init(IClass cls, ITestMethodFinder testMethodFinder, IAnnotationFinder annotationFinder, XmlTest xmlTest, XmlClass xmlClass)

private void
private void
private void
log(int level, String s)

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.
Inherited from org.testng.internal.NoOpTestClass:
getAfterClassMethodsgetAfterGroupsMethodsgetAfterSuiteMethodsgetAfterTestConfigurationMethodsgetAfterTestMethodsgetBeforeClassMethodsgetBeforeGroupsMethodsgetBeforeSuiteMethodsgetBeforeTestConfigurationMethodsgetBeforeTestMethodsgetNamegetRealClassgetTestMethodssetAfterTestMethodsetBeforeTestMethodssetTestClass

Field Detail

afterClassConfigback to summary
private final IdentityHashMap<Object, List<ITestNGMethod>> afterClassConfig
annotationFinderback to summary
private IAnnotationFinder annotationFinder
beforeClassConfigback to summary
private final IdentityHashMap<Object, List<ITestNGMethod>> beforeClassConfig
iClassback to summary
private IClass iClass
LOGback to summary
private static final Logger LOG
m_errorMsgPrefixback to summary
private final String m_errorMsgPrefix
objectFactoryback to summary
private final ITestObjectFactory objectFactory
testMethodFinderback to summary
private ITestMethodFinder testMethodFinder
testNameback to summary
private String testName
xmlClassback to summary
private XmlClass xmlClass
xmlTestback to summary
private XmlTest xmlTest

Constructor Detail

TestClassback to summary
protected TestClass(ITestObjectFactory objectFactory, IClass cls, ITestMethodFinder testMethodFinder, IAnnotationFinder annotationFinder, XmlTest xmlTest, XmlClass xmlClass, String errorMsgPrefix)

Method Detail

addInstanceback to summary
public void addInstance(Object instance)

Overrides org.testng.internal.NoOpTestClass.addInstance.

Implements org.testng.IClass.addInstance.

Parameters
instance:Object

Doc from org.testng.IClass.addInstance.

- The instance to be added.

Annotations
@Override
addObjectback to summary
public void addObject(IObject.IdentifiableObject instance)

Overrides org.testng.internal.NoOpTestClass.addObject.

Implements org.testng.internal.IObject.addObject.

Parameters
instance:IObject.IdentifiableObject

Doc from org.testng.internal.IObject.addObject.

- The instance that should be added to the list of instances.

Annotations
@Override
createTestMethodsback to summary
private ITestNGMethod[] createTestMethods(ITestNGMethod[] methods)

Create the test methods that belong to this class (rejects all those that belong to a different class).

dumpback to summary
protected void dump()
getAllAfterClassMethodsback to summary
public List<ITestNGMethod> getAllAfterClassMethods()

Implements org.testng.internal.ITestClassConfigInfo.getAllAfterClassMethods.

Annotations
@Override
getAllBeforeClassMethodsback to summary
public List<ITestNGMethod> getAllBeforeClassMethods()

Implements org.testng.internal.ITestClassConfigInfo.getAllBeforeClassMethods.

Doc from org.testng.internal.ITestClassConfigInfo.getAllBeforeClassMethods.

get all before class config methods

Returns:List<ITestNGMethod>

all before class config methods

Annotations
@Override
getAllClassLevelConfigsback to summary
private static List<ITestNGMethod> getAllClassLevelConfigs(IdentityHashMap<Object, List<ITestNGMethod>> map)
getAnnotationFinderback to summary
public IAnnotationFinder getAnnotationFinder()
getIClassback to summary
public IClass getIClass()
getInstanceAfterClassMethodsback to summary
public List<ITestNGMethod> getInstanceAfterClassMethods(Object instance)

Implements org.testng.internal.ITestClassConfigInfo.getInstanceAfterClassMethods.

Annotations
@Override
getInstanceBeforeClassMethodsback to summary
public List<ITestNGMethod> getInstanceBeforeClassMethods(Object instance)

Implements org.testng.internal.ITestClassConfigInfo.getInstanceBeforeClassMethods.

Doc from org.testng.internal.ITestClassConfigInfo.getInstanceBeforeClassMethods.

Query the instance before class methods from config methods map.

Parameters
instance:Object

object hashcode

Returns:List<ITestNGMethod>

All before class methods of instance

Annotations
@Override
getInstanceHashCodesback to summary
public long[] getInstanceHashCodes()

Overrides org.testng.internal.NoOpTestClass.getInstanceHashCodes.

Implements org.testng.IClass.getInstanceHashCodes, org.testng.internal.IObject.getInstanceHashCodes.

Returns:long[]

Doc from org.testng.internal.IObject.getInstanceHashCodes.

- An array representing the hash codes of the corresponding instances.

Annotations
@Override
getInstancesback to summary
public Object[] getInstances(boolean create)

Overrides org.testng.internal.NoOpTestClass.getInstances.

Implements org.testng.IClass.getInstances.

Doc from org.testng.IClass.getInstances.

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.

Parameters
create:boolean

flag if a new set of instances must be returned (if set to false)

Returns:Object[]

All the instances the methods will be invoked upon.

Annotations
@Override
getInstancesback to summary
public Object[] getInstances(boolean create, String errorMsgPrefix)

Overrides default org.testng.IClass.getInstances.

Doc from org.testng.IClass.getInstances.

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.

Parameters
create:boolean

flag if a new set of instances must be returned (if set to false)

errorMsgPrefix:String

- Text that should be prefixed to the error message when there are issues. Can be empty.

Returns:Object[]

All the instances the methods will be invoked upon.

Annotations
@Override
getObjectsback to summary
public IObject.IdentifiableObject[] getObjects(boolean create, String errorMsgPrefix)

Overrides org.testng.internal.NoOpTestClass.getObjects.

Implements org.testng.internal.IObject.getObjects.

Doc from org.testng.internal.IObject.getObjects.

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.

Parameters
create:boolean

- true if objects should be created before returning.

errorMsgPrefix:String

- Text that should be prefixed to the error message when there are issues. Can be empty.

Returns:IObject.IdentifiableObject[]

- An array of IdentifiableObject objects

Annotations
@Override
getTestMethodFinderback to summary
public ITestMethodFinder getTestMethodFinder()
getTestNameback to summary
public String getTestName()

Overrides org.testng.internal.NoOpTestClass.getTestName.

Implements org.testng.IClass.getTestName.

Returns:String

Doc from org.testng.IClass.getTestName.

its test name if this class implements org.testng.ITest, null otherwise.

Annotations
@Override
getXmlClassback to summary
public XmlClass getXmlClass()

Overrides org.testng.internal.NoOpTestClass.getXmlClass.

Implements org.testng.IClass.getXmlClass.

Returns:XmlClass

Doc from org.testng.IClass.getXmlClass.

the *lt;class> tag this class was found in.

Annotations
@Override
getXmlTestback to summary
public XmlTest getXmlTest()

Overrides org.testng.internal.NoOpTestClass.getXmlTest.

Implements org.testng.IClass.getXmlTest.

Returns:XmlTest

Doc from org.testng.IClass.getXmlTest.

the <test> tag this class was found in.

Annotations
@Override
initback to summary
private void init(IClass cls, ITestMethodFinder testMethodFinder, IAnnotationFinder annotationFinder, XmlTest xmlTest, XmlClass xmlClass)
initMethodsback to summary
private void initMethods()
initTestClassesAndInstancesback to summary
private void initTestClassesAndInstances()
logback to summary
private void log(int level, String s)
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object.

Returns:String

a string representation of the object

Annotations
@Override