/com.qsgsoft.MPTabletsExisting/src/main/java/qaframework/Configuration/GetInfo.java
https://bitbucket.org/Pushpa-R/mpoldauto · Java · 23 lines · 17 code · 5 blank · 1 comment · 0 complexity · 59ef838dbd61b2047e9b1e0d3c6ab829 MD5 · raw file
- package qaframework.Configuration;
- public class GetInfo {
- @SuppressWarnings({ "rawtypes", "restriction", "deprecation" })
- public static final String getCallingClassName(int parentLevel) {
- // Class CN = sun.reflect.Reflection.getCallerClass(parentLevel);
- Class CN = sun.reflect.Reflection.getCallerClass(parentLevel);
- String className = CN.toString();
- int pageIndex = className.indexOf("page");
- className = className.substring(pageIndex + 5);
- return className;
- }
- public static final String getCallingFunctionName(int parentLevel) {
- StackTraceElement[] stacktrace = Thread.currentThread().getStackTrace();
- StackTraceElement e = stacktrace[parentLevel];
- String methodName = e.getMethodName();
- return methodName;
- }
- }