예제 #1
0
 @Test
 public void getPathComponentsNoExceptionTest() throws InvalidPathException {
   Assert.assertArrayEquals(new String[] {""}, PathUtils.getPathComponents("/"));
   Assert.assertArrayEquals(new String[] {"", "bar"}, PathUtils.getPathComponents("/bar"));
   Assert.assertArrayEquals(
       new String[] {"", "foo", "bar"}, PathUtils.getPathComponents("/foo/bar"));
   Assert.assertArrayEquals(
       new String[] {"", "foo", "bar"}, PathUtils.getPathComponents("/foo/bar/"));
   Assert.assertArrayEquals(new String[] {"", "bar"}, PathUtils.getPathComponents("/foo/../bar"));
   Assert.assertArrayEquals(
       new String[] {"", "foo", "bar", "a", "b", "c"},
       PathUtils.getPathComponents("/foo//bar/a/b/c"));
 }
예제 #2
0
 @Test
 public void getPathComponentsExceptionTest() throws InvalidPathException {
   mException.expect(InvalidPathException.class);
   PathUtils.getPathComponents("/\\   foo / bar");
 }