Remove unnecessary check

This commit is contained in:
René Pfeuffer
2020-03-04 10:54:35 +01:00
parent f2ce14294d
commit cb1d9334bb
2 changed files with 16 additions and 3 deletions

View File

@@ -79,9 +79,6 @@ class HgFileviewCommandResultReader {
private boolean isParent(FileObject parent, FileObject child) {
String parentPath = parent.getPath();
if (parentPath.equals("")) {
return true;
}
return child.getParentPath().equals(parentPath);
}

View File

@@ -64,6 +64,22 @@ class HgFileviewCommandResultReaderTest {
assertThat(fileObject.isTruncated()).isTrue();
}
@Test
void shouldParseSubDirectory() throws IOException {
HgFileviewCommandResultReader reader = new MockInput()
.dir("dir")
.file("dir/a.txt")
.build();
FileObject fileObject = reader.parseResult();
assertThat(fileObject.isDirectory()).isTrue();
assertThat(fileObject.getName()).isEqualTo("dir");
assertThat(fileObject.getChildren())
.extracting("name")
.containsExactly("a.txt");
}
@Test
void shouldParseRecursiveResult() throws IOException {
HgFileviewCommandResultReader reader = new MockInput()