mirror of
https://github.com/scm-manager/scm-manager.git
synced 2026-03-21 03:21:36 +01:00
change browse api in order to build a tree base file structure
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user