本文整理汇总了Java中org.junit.runners.model.FrameworkMethod.getName方法的典型用法代码示例。如果您正苦于以下问题:Java FrameworkMethod.getName方法的具体用法?Java FrameworkMethod.getName怎么用?Java FrameworkMethod.getName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.junit.runners.model.FrameworkMethod
的用法示例。
在下文中一共展示了FrameworkMethod.getName方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: computeTestMethods
import org.junit.runners.model.FrameworkMethod; //导入方法依赖的package包/类
@Override
protected List<FrameworkMethod> computeTestMethods() {
// get all methods to be tested
List<FrameworkMethod> toSort = super.computeTestMethods();
if (toSort.isEmpty())
return toSort;
// a map containing <line_number, method>
final Map<Integer, FrameworkMethod> testMethods = new TreeMap<Integer, FrameworkMethod> ();
// check that all methods here are declared in the same class, we don't
// deal with test methods from superclasses that haven't been overridden
Class<?> clazz = getDeclaringClass(toSort);
if (clazz == null) {
// fail explicitly
System.err
.println("OrderedTestRunner can only run test classes that"
+ " don't have test methods inherited from superclasses");
return Collections.emptyList();
}
// use Javassist to figure out line numbers for methods
ClassPool pool = ClassPool.getDefault();
try {
CtClass cc = pool.get(clazz.getName());
// all methods in toSort are declared in the same class, we checked
for (FrameworkMethod m : toSort) {
String methodName = m.getName();
CtMethod method = cc.getDeclaredMethod(methodName);
testMethods.put(method.getMethodInfo().getLineNumber(0), m);
}
} catch (NotFoundException e) {
e.printStackTrace();
}
return new ArrayList<FrameworkMethod>(testMethods.values());
}
示例2: testName
import org.junit.runners.model.FrameworkMethod; //导入方法依赖的package包/类
@Override
protected String testName(final FrameworkMethod method) {
if (method instanceof UnrolledTestMethod) {
return method.getName() + Spockito.getName(method.getMethod(), ((UnrolledTestMethod)method).getTableRow());
}
return super.testName(method);
}
示例3: starting
import org.junit.runners.model.FrameworkMethod; //导入方法依赖的package包/类
@Override
public void starting(FrameworkMethod method) {
// By default, disable starting a JettyAdminServer in tests to avoid
// accidentally attempting to start multiple admin servers on the
// same port.
System.setProperty("zookeeper.admin.enableServer", "false");
// ZOOKEEPER-2693 disables all 4lw by default.
// Here we enable the 4lw which ZooKeeper tests depends.
System.setProperty("zookeeper.4lw.commands.whitelist", "*");
testName = method.getName();
LOG.info("STARTING " + testName);
}
示例4: apply
import org.junit.runners.model.FrameworkMethod; //导入方法依赖的package包/类
@Override
public Statement apply(Statement statement, FrameworkMethod frameworkMethod, Object o) {
TestHdfs testHdfsAnnotation = frameworkMethod.getAnnotation(TestHdfs.class);
if (testHdfsAnnotation != null) {
statement = new HdfsStatement(statement, frameworkMethod.getName());
}
return super.apply(statement, frameworkMethod, o);
}
示例5: starting
import org.junit.runners.model.FrameworkMethod; //导入方法依赖的package包/类
@Override
public void starting(FrameworkMethod method) {
testName = method.getName();
// ZOOKEEPER-2693 disables all 4lw by default.
// Here we enable the 4lw which ZooKeeper tests depends.
System.setProperty("zookeeper.4lw.commands.whitelist", "*");
LOG.info("STARTING " + testName);
}
示例6: testName
import org.junit.runners.model.FrameworkMethod; //导入方法依赖的package包/类
/**
* Implements behavior from: org.junit.runners.Parameterized$TestClassRunnerForParameters
*/
@Override
protected String testName(FrameworkMethod method) {
return method.getName() + getName();
}
示例7: starting
import org.junit.runners.model.FrameworkMethod; //导入方法依赖的package包/类
@Override
public void starting(FrameworkMethod method) {
testName = method.getName();
LOG.info("STARTING " + testName);
}
示例8: LoggedInvokeMethod
import org.junit.runners.model.FrameworkMethod; //导入方法依赖的package包/类
public LoggedInvokeMethod(FrameworkMethod method, Object target) {
super(method, target);
this.method = method;
name = method.getName();
}
示例9: testName
import org.junit.runners.model.FrameworkMethod; //导入方法依赖的package包/类
@Override
protected String testName(FrameworkMethod method) {
return method.getName() + "@" + suiteClass.getName();
}
示例10: methodBlock
import org.junit.runners.model.FrameworkMethod; //导入方法依赖的package包/类
@Override
protected Statement methodBlock(FrameworkMethod frameworkMethod) {
WebtrekkBaseMainTest.mTestName = frameworkMethod.getName();
return super.methodBlock(frameworkMethod);
}