Skip to content

Commit

Permalink
Fixes #83 - Implement isDirectory for Path implementation (#84)
Browse files Browse the repository at this point in the history
  • Loading branch information
mnriem authored Sep 19, 2023
1 parent 2f98d7e commit 81dfeb8
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -90,4 +90,9 @@ public VirtualFile getFile(String path) {
public List<VirtualFile> getFiles() {
throw new UnsupportedOperationException("Not supported yet.");
}

@Override
public boolean isDirectory() {
return file.toFile().isDirectory();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@

import com.manorrock.hummingbird.api.VirtualFile;
import java.io.File;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertTrue;
import org.junit.jupiter.api.Test;

/**
Expand All @@ -46,4 +48,16 @@ public void testAsInputStream() {
VirtualFile folder = fileSystem.getRootFolder();
assertNotNull(folder.getFile("pom.xml").asInputStream());
}

/**
* Test isDirectory method.
*/
@Test
public void testIsDirectory() {
PathFileSystem fileSystem = new PathFileSystem(new File(".").toPath());
VirtualFile folder = fileSystem.getRootFolder();
assertTrue(folder.isDirectory());
VirtualFile file = folder.getFile("pom.xml");
assertFalse(file.isDirectory());
}
}

0 comments on commit 81dfeb8

Please sign in to comment.