mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-12 08:25:44 +01:00
Add tests for recursive request
This commit is contained in:
@@ -209,6 +209,76 @@ public class HgBrowseCommandTest extends AbstractHgCommandTestBase {
|
||||
assertThat(root.isTruncated()).isFalse();
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testRecursiveLimit() throws IOException {
|
||||
BrowseCommandRequest request = new BrowseCommandRequest();
|
||||
|
||||
request.setLimit(4);
|
||||
request.setRecursive(true);
|
||||
|
||||
FileObject root = new HgBrowseCommand(cmdContext, repository).getBrowserResult(request).getFile();
|
||||
|
||||
Collection<FileObject> foList = root.getChildren();
|
||||
|
||||
assertThat(foList)
|
||||
.extracting("name")
|
||||
.containsExactly("c", "a.txt");
|
||||
|
||||
FileObject c = getFileObject(foList, "c");
|
||||
|
||||
Collection<FileObject> cChildren = c.getChildren();
|
||||
assertThat(cChildren)
|
||||
.extracting("name")
|
||||
.containsExactly("d.txt", "e.txt");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRecursiveLimitInSubDir() throws IOException {
|
||||
BrowseCommandRequest request = new BrowseCommandRequest();
|
||||
|
||||
request.setLimit(2);
|
||||
request.setRecursive(true);
|
||||
|
||||
FileObject root = new HgBrowseCommand(cmdContext, repository).getBrowserResult(request).getFile();
|
||||
|
||||
Collection<FileObject> foList = root.getChildren();
|
||||
|
||||
assertThat(foList)
|
||||
.extracting("name")
|
||||
.containsExactly("c");
|
||||
|
||||
FileObject c = getFileObject(foList, "c");
|
||||
|
||||
Collection<FileObject> cChildren = c.getChildren();
|
||||
assertThat(cChildren)
|
||||
.extracting("name")
|
||||
.containsExactly("d.txt");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRecursiveOffset() throws IOException {
|
||||
BrowseCommandRequest request = new BrowseCommandRequest();
|
||||
|
||||
request.setOffset(2);
|
||||
request.setRecursive(true);
|
||||
|
||||
FileObject root = new HgBrowseCommand(cmdContext, repository).getBrowserResult(request).getFile();
|
||||
|
||||
Collection<FileObject> foList = root.getChildren();
|
||||
|
||||
assertThat(foList)
|
||||
.extracting("name")
|
||||
.containsExactly("c", "a.txt", "b.txt", "f.txt");
|
||||
|
||||
FileObject c = getFileObject(foList, "c");
|
||||
|
||||
Collection<FileObject> cChildren = c.getChildren();
|
||||
assertThat(cChildren)
|
||||
.extracting("name")
|
||||
.containsExactly("e.txt");
|
||||
}
|
||||
|
||||
//~--- get methods ----------------------------------------------------------
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user