Merge pull request #11910 from dreis2211:optimize-applicationhome-unittest-check

* pr/11910:
  Optimize ApplicationHome.isUnitTest()
pull/11947/head
Stephane Nicoll 7 years ago
commit f78a55851d

@ -105,7 +105,9 @@ public class ApplicationHome {
private boolean isUnitTest() {
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.")) {
return true;
}

Loading…
Cancel
Save