change browse api in order to build a tree base file structure

This commit is contained in:
Sebastian Sdorra
2018-10-08 14:38:27 +02:00
parent 27573bc4cf
commit e5a3cbb50e
5 changed files with 118 additions and 224 deletions

View File

@@ -0,0 +1,32 @@
package sonia.scm.repository;
import org.junit.Test;
import static org.junit.Assert.*;
public class FileObjectTest {
@Test
public void getParentPath() {
FileObject file = create("a/b/c");
assertEquals("a/b", file.getParentPath());
}
@Test
public void getParentPathWithoutParent() {
FileObject file = create("a");
assertEquals("", file.getParentPath());
}
@Test
public void getParentPathOfRoot() {
FileObject file = create("");
assertNull(file.getParentPath());
}
private FileObject create(String path) {
FileObject file = new FileObject();
file.setPath(path);
return file;
}
}