Attach LeakHunter output to the exception message

for better diagnostic output in test results.
This commit is contained in:
Stefan Xenos
2017-12-14 14:24:03 +03:00
committed by Alexey Kudravtsev
parent 55c60b7d62
commit 06976e0219
@@ -60,12 +60,13 @@ public class LeakHunter {
@Nullable final Condition<? super T> isReallyLeak) throws AssertionError {
processLeaks(roots, suspectClass, isReallyLeak, (leaked, backLink)->{
String place = leaked instanceof Project ? PlatformTestCase.getCreationPlace((Project)leaked) : "";
System.out.println("Found leaked "+leaked.getClass() + ": "+leaked +
"; hash: " + System.identityHashCode(leaked) + "; place: " + place);
System.out.println(backLink);
String message ="Found leaked "+leaked.getClass() + ": "+leaked +
"; hash: " + System.identityHashCode(leaked) + "; place: " + place + "\n" +
backLink;
System.out.println(message);
System.out.println(";-----");
throw new AssertionError();
throw new AssertionError(message);
});
}