Package org.testng
Class TestClass
- java.lang.Object
-
- org.testng.internal.NoOpTestClass
-
- org.testng.TestClass
-
- All Implemented Interfaces:
IClass
,ITestClassConfigInfo
,ITestClass
class TestClass extends NoOpTestClass implements ITestClass, ITestClassConfigInfo
This class represents a test class: - The test methods - The configuration methods (test and method) - The class file
-
-
Field Summary
Fields Modifier and Type Field Description private IAnnotationFinder
annotationFinder
private java.util.IdentityHashMap<java.lang.Object,java.util.List<ITestNGMethod>>
beforeClassConfig
private IClass
iClass
private static Logger
LOG
private java.lang.String
m_errorMsgPrefix
private ITestObjectFactory
objectFactory
private ITestMethodFinder
testMethodFinder
private java.lang.String
testName
private XmlClass
xmlClass
private XmlTest
xmlTest
-
Fields inherited from class org.testng.internal.NoOpTestClass
m_afterClassMethods, m_afterGroupsMethods, m_afterSuiteMethods, m_afterTestConfMethods, m_afterTestMethods, m_beforeClassMethods, m_beforeGroupsMethods, m_beforeSuiteMethods, m_beforeTestConfMethods, m_beforeTestMethods, m_testClass, m_testMethods
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
TestClass(ITestObjectFactory objectFactory, IClass cls, ITestMethodFinder testMethodFinder, IAnnotationFinder annotationFinder, XmlTest xmlTest, XmlClass xmlClass, java.lang.String errorMsgPrefix)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addInstance(java.lang.Object instance)
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()
java.util.List<ITestNGMethod>
getAllBeforeClassMethods()
get all before class config methodsIAnnotationFinder
getAnnotationFinder()
IClass
getIClass()
java.util.List<ITestNGMethod>
getInstanceBeforeClassMethods(java.lang.Object instance)
Query the instance before class methods from config methods map.long[]
getInstanceHashCodes()
java.lang.Object[]
getInstances(boolean create)
Returns all the instances the methods will be invoked upon.java.lang.Object[]
getInstances(boolean create, java.lang.String errorMsgPrefix)
ITestMethodFinder
getTestMethodFinder()
java.lang.String
getTestName()
XmlClass
getXmlClass()
XmlTest
getXmlTest()
private void
init(IClass cls, ITestMethodFinder testMethodFinder, IAnnotationFinder annotationFinder, XmlTest xmlTest, XmlClass xmlClass)
private void
initMethods()
private void
initTestClassesAndInstances()
private void
log(int level, java.lang.String s)
java.lang.String
toString()
-
Methods inherited from class org.testng.internal.NoOpTestClass
getAfterClassMethods, getAfterGroupsMethods, getAfterSuiteMethods, getAfterTestConfigurationMethods, getAfterTestMethods, getBeforeClassMethods, getBeforeGroupsMethods, getBeforeSuiteMethods, getBeforeTestConfigurationMethods, getBeforeTestMethods, getName, getRealClass, getTestMethods, setAfterTestMethod, setBeforeTestMethods, setTestClass
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.testng.IClass
getName, getRealClass
-
Methods inherited from interface org.testng.ITestClass
getAfterClassMethods, getAfterGroupsMethods, getAfterSuiteMethods, getAfterTestConfigurationMethods, getAfterTestMethods, getBeforeClassMethods, getBeforeGroupsMethods, getBeforeSuiteMethods, getBeforeTestConfigurationMethods, getBeforeTestMethods, getTestMethods
-
-
-
-
Field Detail
-
annotationFinder
private IAnnotationFinder annotationFinder
-
testMethodFinder
private ITestMethodFinder testMethodFinder
-
iClass
private IClass iClass
-
testName
private java.lang.String testName
-
xmlTest
private XmlTest xmlTest
-
xmlClass
private XmlClass xmlClass
-
objectFactory
private final ITestObjectFactory objectFactory
-
m_errorMsgPrefix
private final java.lang.String m_errorMsgPrefix
-
beforeClassConfig
private final java.util.IdentityHashMap<java.lang.Object,java.util.List<ITestNGMethod>> beforeClassConfig
-
LOG
private static final Logger LOG
-
-
Constructor Detail
-
TestClass
protected TestClass(ITestObjectFactory objectFactory, IClass cls, ITestMethodFinder testMethodFinder, IAnnotationFinder annotationFinder, XmlTest xmlTest, XmlClass xmlClass, java.lang.String errorMsgPrefix)
-
-
Method Detail
-
getAllBeforeClassMethods
public java.util.List<ITestNGMethod> getAllBeforeClassMethods()
Description copied from interface:ITestClassConfigInfo
get all before class config methods- Specified by:
getAllBeforeClassMethods
in interfaceITestClassConfigInfo
- Returns:
- all before class config methods
-
getInstanceBeforeClassMethods
public java.util.List<ITestNGMethod> getInstanceBeforeClassMethods(java.lang.Object instance)
Description copied from interface:ITestClassConfigInfo
Query the instance before class methods from config methods map.- Specified by:
getInstanceBeforeClassMethods
in interfaceITestClassConfigInfo
- Parameters:
instance
- object hashcode- Returns:
- All before class methods of instance
-
getTestName
public java.lang.String getTestName()
- Specified by:
getTestName
in interfaceIClass
- Overrides:
getTestName
in classNoOpTestClass
- Returns:
- its test name if this class implements org.testng.ITest, null otherwise.
-
getXmlTest
public XmlTest getXmlTest()
- Specified by:
getXmlTest
in interfaceIClass
- Overrides:
getXmlTest
in classNoOpTestClass
- Returns:
- the <test> tag this class was found in.
-
getXmlClass
public XmlClass getXmlClass()
- Specified by:
getXmlClass
in interfaceIClass
- Overrides:
getXmlClass
in classNoOpTestClass
- Returns:
- the *lt;class> tag this class was found in.
-
getAnnotationFinder
public IAnnotationFinder getAnnotationFinder()
-
init
private void init(IClass cls, ITestMethodFinder testMethodFinder, IAnnotationFinder annotationFinder, XmlTest xmlTest, XmlClass xmlClass)
-
initTestClassesAndInstances
private void initTestClassesAndInstances()
-
getInstances
public java.lang.Object[] getInstances(boolean create)
Description copied from interface:IClass
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 interfaceIClass
- Overrides:
getInstances
in classNoOpTestClass
- Parameters:
create
- flag if a new set of instances must be returned (if set tofalse
)- Returns:
- All the instances the methods will be invoked upon.
- See Also:
IClass.getInstances(boolean)
-
getInstances
public java.lang.Object[] getInstances(boolean create, java.lang.String errorMsgPrefix)
- Specified by:
getInstances
in interfaceIClass
-
getInstanceHashCodes
public long[] getInstanceHashCodes()
- Specified by:
getInstanceHashCodes
in interfaceIClass
- Overrides:
getInstanceHashCodes
in classNoOpTestClass
- See Also:
IClass.getInstanceHashCodes()
-
addInstance
public void addInstance(java.lang.Object instance)
- Specified by:
addInstance
in interfaceIClass
- Overrides:
addInstance
in classNoOpTestClass
- See Also:
IClass.addInstance(java.lang.Object)
-
initMethods
private void initMethods()
-
createTestMethods
private ITestNGMethod[] createTestMethods(ITestNGMethod[] methods)
Create the test methods that belong to this class (rejects all those that belong to a different class).
-
getTestMethodFinder
public ITestMethodFinder getTestMethodFinder()
-
log
private void log(int level, java.lang.String s)
-
dump
protected void dump()
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
getIClass
public IClass getIClass()
-
-