Details
-
Improvement
-
Status: Open
-
Major
-
Resolution: Unresolved
-
None
-
None
Description
The current mybatis method for determining the test class is based on the following codes:
private static void checkCalledByTestMethod() { StackTraceElement[] stackTraceElements = Thread.currentThread().getStackTrace(); for (StackTraceElement element : stackTraceElements) { if (element.getClassName().endsWith("Test")) { usingTestDatabase(); return; } } }
Such code is clearly a hard code approach and may not cover all test methods by name.
We should use something that is easier to determine and more precise