org.test4j.module.core
类 TestContext

java.lang.Object
  继承者 org.test4j.module.core.TestContext

public class TestContext
extends Object

测试类(对象)上下文

作者:
darui.wudr 2013-1-10 下午10:53:01

方法摘要
static void addThrowable(Throwable e)
          用来收集测试过程中可能被其它异常吞噬的异常
static TestContext context()
           
static Class currTestedClazz()
          当前测试类的类名称
static String currTestedClazzName()
          当前测试类名称
static Method currTestedMethod()
           
static String currTestedMethodName()
           
static Object currTestedObject()
          当前测试类
static RuntimeException getMultipleException(Throwable cause)
          封装多个异常,如果当前测试没有记录的历史异常,则直接返回cause
否则返回一个MutipleException
static void setContext(Class claz)
          设置测试上下文的测试类
测试实例和测试方法置空
static void setContext(Object testedObject, Method testedMethod)
          设置测试上下文信息
 
从类 java.lang.Object 继承的方法
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

方法详细信息

context

public static final TestContext context()

setContext

public static final void setContext(Class claz)
设置测试上下文的测试类
测试实例和测试方法置空

参数:
claz -

setContext

public static final void setContext(Object testedObject,
                                    Method testedMethod)
设置测试上下文信息

参数:
testedObject -
testedMethod -

addThrowable

public static final void addThrowable(Throwable e)
用来收集测试过程中可能被其它异常吞噬的异常

参数:
e -

getMultipleException

public static RuntimeException getMultipleException(Throwable cause)
封装多个异常,如果当前测试没有记录的历史异常,则直接返回cause
否则返回一个MutipleException

参数:
cause -
返回:

currTestedClazzName

public static String currTestedClazzName()
当前测试类名称

返回:

currTestedMethodName

public static String currTestedMethodName()

currTestedMethod

public static Method currTestedMethod()

currTestedClazz

public static Class currTestedClazz()
当前测试类的类名称

返回:

currTestedObject

public static Object currTestedObject()
当前测试类

返回:


Copyright © 2013. All rights reserved.