本文整理匯總了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();
}
}
}