本文整理汇总了Java中spoon.reflect.declaration.CtMethod.isImplicit方法的典型用法代码示例。如果您正苦于以下问题:Java CtMethod.isImplicit方法的具体用法?Java CtMethod.isImplicit怎么用?Java CtMethod.isImplicit使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类spoon.reflect.declaration.CtMethod
的用法示例。
在下文中一共展示了CtMethod.isImplicit方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: isTest
import spoon.reflect.declaration.CtMethod; //导入方法依赖的package包/类
protected boolean isTest(CtMethod candidate) {
if(candidate.isImplicit()
|| !candidate.getModifiers().contains(ModifierKind.PUBLIC)
|| candidate.getBody() == null
|| candidate.getBody().getStatements().size() == 0) {
return false;
}
if(!guavaTestlib) {
return candidate.getSimpleName().contains("test")
|| candidate.getAnnotations().stream()
.map(annotation -> annotation.toString())
.anyMatch(annotation -> annotation.startsWith("@org.junit.Test"));
} else {
return candidate.getDeclaringType().getSimpleName().endsWith("Tester")
&& (candidate.getSimpleName().contains("test")
|| candidate.getAnnotations().stream()
.map(annotation -> annotation.toString())
.anyMatch(annotation -> annotation.startsWith("@org.junit.Test")));
}
}
示例2: isTest
import spoon.reflect.declaration.CtMethod; //导入方法依赖的package包/类
public static boolean isTest(CtMethod<?> candidate) {
CtClass<?> parent = candidate.getParent(CtClass.class);
if (candidate.getAnnotation(org.junit.Ignore.class) != null) {
return false;
}
if (candidate.isImplicit()
|| candidate.getVisibility() == null
|| !candidate.getVisibility().equals(ModifierKind.PUBLIC)
|| candidate.getBody() == null
|| candidate.getBody().getStatements().size() == 0
|| !candidate.getParameters().isEmpty()) {
return false;
}
List<CtInvocation> listOfAssertion =
candidate.getBody().getElements(new TypeFilter<CtInvocation>(CtInvocation.class) {
@Override
public boolean matches(CtInvocation element) {
return hasAssertCall.test(element);
}
});
if (listOfAssertion.isEmpty()) {
listOfAssertion.addAll(candidate.getBody().getElements(new HasAssertInvocationFilter(3)));
}
if (!listOfAssertion.isEmpty()) {
return true;
}
return (candidate.getAnnotation(org.junit.Test.class) != null ||
((candidate.getSimpleName().contains("test") ||
candidate.getSimpleName().contains("should")) && !isTestJUnit4(parent)));
}