-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#236: simplifies file handling for end2end tests
- Loading branch information
1 parent
b918d2a
commit bac1103
Showing
51 changed files
with
184 additions
and
185 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
3 changes: 3 additions & 0 deletions
3
app-tests/src/test/scala/app/logorrr/services/file/EmptyFileService.scala
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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
package app.logorrr.services.file | ||
|
||
class EmptyFileService extends MockFileService(Seq()) |
21 changes: 21 additions & 0 deletions
21
app-tests/src/test/scala/app/logorrr/services/file/MockFileService.scala
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 |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package app.logorrr.services.file | ||
|
||
import app.logorrr.io.FileId | ||
|
||
/** | ||
* Given a list of files, it returns each file in order, and if the last file is reached, a | ||
* `None` | ||
* | ||
* @param files which this service is returning | ||
*/ | ||
class MockFileService(files: Seq[FileId]) extends FileService { | ||
|
||
private val it = files.iterator | ||
|
||
override def openFile: Option[FileId] = { | ||
if (it.hasNext) { | ||
Option(it.next()) | ||
} else None | ||
} | ||
|
||
} |
10 changes: 10 additions & 0 deletions
10
app-tests/src/test/scala/app/logorrr/services/file/SingleFileService.scala
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 |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package app.logorrr.services.file | ||
|
||
import app.logorrr.io.FileId | ||
|
||
/** | ||
* Service which always opens given file | ||
* | ||
* @param fileId file reference to open | ||
*/ | ||
class SingleFileService(fileId: FileId) extends MockFileService(Seq(fileId)) |
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
11 changes: 5 additions & 6 deletions
11
app-tests/src/test/scala/app/logorrr/usecases/MultipleFileApplicationTest.scala
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,26 +1,25 @@ | ||
package app.logorrr.usecases | ||
|
||
import app.logorrr.conf.Settings | ||
import app.logorrr.io.FileId | ||
import app.logorrr.services.LogoRRRServices | ||
import app.logorrr.services.fileservices.OpenMultipleFilesService | ||
import app.logorrr.services.file.MockFileService | ||
import app.logorrr.services.hostservices.MockHostServices | ||
import app.logorrr.steps.{CanStartApplication, VisibleItemActions} | ||
|
||
import java.nio.file.Path | ||
|
||
/** | ||
* Extend this class if you have tests which involve more than one file | ||
* | ||
* @param files files which are supported for this test | ||
*/ | ||
class MultipleFileApplicationTest(val files: Seq[Path]) | ||
class MultipleFileApplicationTest(val files: Seq[FileId]) | ||
extends TestFxBaseApplicationTest | ||
with CanStartApplication | ||
with VisibleItemActions{ | ||
with VisibleItemActions { | ||
|
||
lazy val services: LogoRRRServices = LogoRRRServices(Settings.Default | ||
, new MockHostServices | ||
, new OpenMultipleFilesService(files) | ||
, new MockFileService(files) | ||
, isUnderTest = true) | ||
|
||
} |
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
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
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
Oops, something went wrong.