Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Formatting

  • Loading branch information...
commit 2ad9a7d492732033a47845a585febd9bbcd1a060 1 parent 36a7446
@mnuessler authored
Showing with 5 additions and 9 deletions.
  1. +5 −9 src/main/java/org/nuessler/junit/util/rule/FailureLogger.java
View
14 src/main/java/org/nuessler/junit/util/rule/FailureLogger.java
@@ -35,16 +35,14 @@ protected void failed(Throwable e, Description description) {
.getFailures() : Collections.singletonList(e);
for (Throwable t : failures) {
- StackTraceElement element = findStrackTraceForClass(
- t.getStackTrace(), description.getClassName());
+ StackTraceElement element = findStrackTraceForClass(t.getStackTrace(), description.getClassName());
if (element != null) {
log(formatMessage(description, element, t));
}
}
}
- private StackTraceElement findStrackTraceForClass(
- StackTraceElement[] elements, String className) {
+ private StackTraceElement findStrackTraceForClass(StackTraceElement[] elements, String className) {
for (StackTraceElement element : elements) {
if (element.getClassName().contains(className)) {
return element;
@@ -53,11 +51,9 @@ private StackTraceElement findStrackTraceForClass(
return null;
}
- private String formatMessage(Description description,
- StackTraceElement element, Throwable t) {
- return String.format("%s in %s#%s, line %s: %s", t.getClass()
- .getCanonicalName(), description.getTestClass(), description
- .getMethodName(), element.getLineNumber(),
+ private String formatMessage(Description description, StackTraceElement element, Throwable t) {
+ return String.format("%s in %s#%s, line %s: %s", t.getClass().getCanonicalName(), description.getTestClass(),
+ description.getMethodName(), element.getLineNumber(),
t.getMessage() == null ? "<no message>" : t.getMessage());
}
Please sign in to comment.
Something went wrong with that request. Please try again.