本文整理汇总了Java中org.junit.runner.notification.Failure.getMessage方法的典型用法代码示例。如果您正苦于以下问题:Java Failure.getMessage方法的具体用法?Java Failure.getMessage怎么用?Java Failure.getMessage使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.junit.runner.notification.Failure
的用法示例。
在下文中一共展示了Failure.getMessage方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: isKnownIssue
import org.junit.runner.notification.Failure; //导入方法依赖的package包/类
private boolean isKnownIssue(Failure failure) {
if (failure == null) {
return false;
}
if (failure.getDescription() == null) {
return false;
}
final KnownIssue knownIssue = failure.getDescription().getAnnotation(KnownIssue.class);
final String message = failure.getMessage();
if (knownIssue == null || message == null || knownIssue.value() == null) {
return false;
}
if (message.contains(knownIssue.value())) {
return true;
}
return false;
}
示例2: testFailure
import org.junit.runner.notification.Failure; //导入方法依赖的package包/类
@Override
public void testFailure(Failure failure) throws Exception {
if (failure != null && failure.getMessage() != null
&& failure.getMessage().startsWith(TEST_TIMED_OUT_PREFIX)) {
output.println("====> TEST TIMED OUT. PRINTING THREAD DUMP. <====");
output.println();
output.print(buildThreadDiagnosticString());
}
}
示例3: formFailureDescription
import org.junit.runner.notification.Failure; //导入方法依赖的package包/类
private static String formFailureDescription(Failure failure) {
return failure.getMessage() + " " +failure.getDescription() + " " + failure.getException().getMessage();
}
示例4: testFailure
import org.junit.runner.notification.Failure; //导入方法依赖的package包/类
@Override
public void testFailure(Failure failure) throws Exception {
if (working) {
if (failure.getDescription().getMethodName() == null) {
// before class failed
for (Description child : failure.getDescription().getChildren()) {
// mark all methods failed
testFailure(new Failure(child, failure.getException()));
}
} else {
// normal failure
Element testcase = createTestCase(failure.getDescription());
Element element;
if (failure.getException() instanceof AssertionError) {
if (isKnownIssue(failure)) {
ignored.incrementAndGet();
element = xml.createElement("skipped");
}
else {
failures.incrementAndGet();
element = xml.createElement("failure");
}
} else {
errors.incrementAndGet();
element = xml.createElement("error");
}
testcase.appendChild(element);
final String message;
if (isSinceVersion(failure)) {
message = prependSinceVersionJira(failure, failure.getMessage());
}
else {
message = failure.getMessage();
}
element.setAttribute("type", safeString(failure.getException().getClass().getName()));
element.setAttribute("message", safeString(message));
element.appendChild(xml.createCDATASection(safeString(failure.getTrace())));
testsuite.get().appendChild(testcase);
writeXml();
}
}
}