Commit 7108a1fc authored by dreis2211's avatar dreis2211 Committed by Stephane Nicoll

Optimize ApplicationHome.isUnitTest()

Closes gh-11910
parent 825397bc
...@@ -105,7 +105,9 @@ public class ApplicationHome { ...@@ -105,7 +105,9 @@ public class ApplicationHome {
private boolean isUnitTest() { private boolean isUnitTest() {
try { try {
for (StackTraceElement element : Thread.currentThread().getStackTrace()) { StackTraceElement[] stackTrace = Thread.currentThread().getStackTrace();
for (int i = stackTrace.length - 1; i >= 0; i--) {
StackTraceElement element = stackTrace[i];
if (element.getClassName().startsWith("org.junit.")) { if (element.getClassName().startsWith("org.junit.")) {
return true; return true;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment