AppRootFinder { public static Path findCurrent() { return findCurrent(1); } private  AppRootFinder(); static Path findCurrent(); static Path findCurrent(int callDepth); static Path find(Class<?> clazz);  }
@Test void findCurrent() { final Path path = Paths.get(AppRootFinder.findCurrent().toString(), AppRootFinderTest.class.getName().replace('.', File.separatorChar) + ".class"); assertThat(path).isRegularFile(); }
@Test void findCurrentWithCallDepth() { final Path path = AppRootFinder.findCurrent(1); assertThat(path.toUri().toString()).matches(".*/[^/]*junit[^/]*\\.jar$"); }
@Test void findCurrentWithBadCallDepth() { assertThatThrownBy(() -> AppRootFinder.findCurrent(-1)).isInstanceOf(IndexOutOfBoundsException.class); assertThatThrownBy(() -> AppRootFinder.findCurrent(8192)).isInstanceOf(IndexOutOfBoundsException.class); }