AllButFirstTokenPathResolver implements PathResolver { @Override public Path getPathFor(Environment environment) { String[] tokens = environment.getName().split("/"); return FileSystems.getDefault().getPath("", Arrays.copyOfRange(tokens, 1, tokens.length)); }  @Override Path getPathFor(Environment environment);  }
@Test void resolvesEmptyStringToEmptyPath() { when(environment.getName()).thenReturn("us-west-1/"); assertThat(pathResolver.getPathFor(environment).toString()).isEqualTo(""); }
@Test void discardsFirstToken() { when(environment.getName()).thenReturn("us-west-1/local/path"); assertThat(pathResolver.getPathFor(environment).toString()).isEqualTo("local/path"); }
@Test void ignoresMissingFirstToken() { when(environment.getName()).thenReturn("/local/path"); assertThat(pathResolver.getPathFor(environment).toString()).isEqualTo("local/path"); }
@Test void treatsMissingPathAsEmptyPath() { when(environment.getName()).thenReturn("us-west-1/"); assertThat(pathResolver.getPathFor(environment).toString()).isEqualTo(""); }