本文整理汇总了Java中org.testng.internal.ConstructorOrMethod.getMethod方法的典型用法代码示例。如果您正苦于以下问题:Java ConstructorOrMethod.getMethod方法的具体用法?Java ConstructorOrMethod.getMethod怎么用?Java ConstructorOrMethod.getMethod使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.testng.internal.ConstructorOrMethod
的用法示例。
在下文中一共展示了ConstructorOrMethod.getMethod方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: intercept
import org.testng.internal.ConstructorOrMethod; //导入方法依赖的package包/类
@Override
public List<IMethodInstance> intercept(List<IMethodInstance> methods, ITestContext context) {
for (IMethodInstance methodIns : methods) {
ITestNGMethod method = methodIns.getMethod();
ConstructorOrMethod meth = method.getConstructorOrMethod();
Method m = meth.getMethod();
if (m != null) {
DB db = m.getAnnotation(DB.class);
if (db != null) {
TransactionLegacy txn = TransactionLegacy.open(m.getName());
}
}
}
// TODO Auto-generated method stub
return methods;
}
示例2: getMethodAnnotation
import org.testng.internal.ConstructorOrMethod; //导入方法依赖的package包/类
/**
* Returns method annotation by specified annotation class from
* from TestNG Method or null if the method does not contain
* such annotation.
*
* @param annotation Annotation class to find
* @param testResult Where to find
* @return {@link Annotation} or null if doesn't exists
*/
private <T extends Annotation> T getMethodAnnotation(Class<T> annotation, ITestResult testResult) {
ITestNGMethod testNGMethod = testResult.getMethod();
if (null != testNGMethod) {
ConstructorOrMethod constructorOrMethod = testNGMethod.getConstructorOrMethod();
if (null != constructorOrMethod) {
Method method = constructorOrMethod.getMethod();
if (null != method) {
return method.getAnnotation(annotation);
}
}
}
return null;
}
示例3: onFinish
import org.testng.internal.ConstructorOrMethod; //导入方法依赖的package包/类
@SuppressWarnings(
{ "rawtypes", "unchecked" } )
public void onFinish( ITestContext context )
{
LOGGER.info( context.getCurrentXmlTest().toXml( " " ) );
/**
* IResultMap results = context.getPassedTests(); Set<ITestResult>
* testResults = results.getAllResults(); for(ITestResult tResult :
* testResults) { //tResult. }
*/
for ( ITestNGMethod method : context.getAllTestMethods() )
{
ConstructorOrMethod mOrC = method.getConstructorOrMethod();
if ( mOrC == null )
{
LOGGER.info( "ConstructorOrMethod null" );
continue;
}
Method m = mOrC.getMethod();
if ( m == null )
{
LOGGER.info( "Method null" );
continue;
}
Class c = m.getDeclaringClass();
if ( c == null )
{
LOGGER.info( "Class null" );
continue;
}
LOGGER.info( c.getCanonicalName() + ":" + m.getName() );
CatsTestStep catsTestStepAnnotation = m.getAnnotation( CatsTestStep.class );
CatsTestCase catsTestCaseAnnotation = ( CatsTestCase ) c.getAnnotation( CatsTestCase.class );
if ( catsTestStepAnnotation == null || catsTestCaseAnnotation == null )
{
LOGGER.info( "Annotations not found" );
continue;
}
LOGGER.info( catsTestCaseAnnotation.name() + ":" + catsTestStepAnnotation.name() );
}
LOGGER.info( "On Finish Found" );
}