Optimize ApplicationHome.isUnitTest()
Closes gh-11910
This commit is contained in:
committed by
Stephane Nicoll
parent
825397bc57
commit
7108a1fc49
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user