ModernJavaRuntime extends AbstractJavaRuntime { @Override public String getCallerClassName(final int depth) { return StackWalker.getInstance().walk(new FixedStackFrameExtractor(depth)).getClassName(); } ModernJavaRuntime(); @Override boolean isAndroid(); @Override long getProcessId(); @Override Timestamp getStartTime(); @Override String getCallerClassName(final int depth); @Override String getCallerClassName(final String loggerClassName); @Override StackTraceElement getCallerStackTraceElement(final int depth); @Override StackTraceElement getCallerStackTraceElement(final String loggerClassName); @Override Timestamp createTimestamp(); @Override TimestampFormatter createTimestampFormatter(final String pattern, final Locale locale);  }
@Test public void callerClassNameByIndex() { assertThat(new ModernJavaRuntime().getCallerClassName(1)).isEqualTo(ModernJavaRuntimeTest.class.getName()); }
@Test public void callerClassNameBySuccessor() { assertThat(new ModernJavaRuntime().getCallerClassName(ModernJavaRuntime.class.getName())) .isEqualTo(ModernJavaRuntimeTest.class.getName()); }