PathHelper { public boolean isPathContainingIllegalCharacters(final String path) { return path == null || path.startsWith("../") || path.indexOf("/../") != -1; }  boolean isPathContainingIllegalCharacters(final String path); String getNormalizedDirectoryPath(final String path); boolean isDirectoryPath(final String originalPath);  }
@Test public void shouldNotAcceptInvalidCharacters() { assertThat(pathHelper.isPathContainingIllegalCharacters("somepath../"), is(false)); assertThat(pathHelper.isPathContainingIllegalCharacters("../somepath"), is(true)); assertThat(pathHelper.isPathContainingIllegalCharacters("somepath/../"), is(true)); assertThat(pathHelper.isPathContainingIllegalCharacters(null), is(true)); }