-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9a49d21
commit 432508b
Showing
10 changed files
with
55 additions
and
149 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,40 @@ | ||
package model | ||
|
||
import org.junit.jupiter.api.Test | ||
import java.nio.file.Files | ||
import java.nio.file.Path | ||
import java.nio.file.Paths | ||
import kotlin.streams.asSequence | ||
import kotlin.test.assertTrue | ||
|
||
class FileSystemEntityFactoryTest { | ||
private lateinit var tempDir: Path | ||
private lateinit var explorerDirectory: ExplorerDirectory | ||
|
||
@Test | ||
fun createEntity() { | ||
tempDir = DirExplorerTestUtil.setupTestDirectory() | ||
explorerDirectory = ExplorerDirectory(tempDir.toString()) | ||
val filesInDir = Files.list(Paths.get(tempDir.toString())).asSequence() | ||
for (elem in filesInDir) { | ||
val respectiveEntity = FileSystemEntityFactory.createEntity(elem.toString()) | ||
|
||
// Check the type of the respectiveEntity | ||
when (elem.fileName.toString()) { | ||
"file2.txt", "file1.txt", "file.log", "document1.pdf", "image2.jpeg", "image1.png" -> { | ||
assertTrue(respectiveEntity is ExplorerFile) | ||
} | ||
"root_to_subfile1" -> { | ||
assertTrue(respectiveEntity is ExplorerSymLink) | ||
} | ||
"subdir2", "emptydir", "subdir1" -> { | ||
assertTrue(respectiveEntity is ExplorerDirectory) | ||
} | ||
"archive.zip" -> { | ||
assertTrue(respectiveEntity is ZipArchive) | ||
} | ||
} | ||
} | ||
DirExplorerTestUtil.teardownTestDirectory() | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,4 +19,4 @@ class DirectoryContentServiceTest { | |
@Test | ||
fun updateSortOrder() { | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,4 +7,4 @@ class EntityActionsHandlerTest { | |
@Test | ||
fun performEntityAction() { | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.