Commit a199338a authored by Ihrig, Arvid Conrad (ari)'s avatar Ihrig, Arvid Conrad (ari)
Browse files

Integrated Pipeline: added property matchers for FileTreeParsingResult messages

parent e763df06
......@@ -2,6 +2,8 @@ package eu.nomad_lab.integrated_pipeline_tests
import java.nio.file.{ Path, Paths }
import eu.nomad_lab.TreeType.TreeType
import eu.nomad_lab.integrated_pipeline.OutputType.OutputType
import eu.nomad_lab.integrated_pipeline.messages._
import eu.nomad_lab.parsers.ParseResult.ParseResult
import eu.nomad_lab.parsers.{ FinishedParsingSession, ParseEvent, StartedParsingSession }
......@@ -155,4 +157,63 @@ trait FileParsingResultMatchers {
display = (x: FileParsingResult) => x.error.toString
)
}
trait FileTreeParsingResultMatchers {
def treeTask(expectedValue: FileTreeScanTask): HavePropertyMatcher[FileTreeParsingResult, FileTreeScanTask] =
Helpers.propertyMatcher(
propertyName = "origin tree task",
expected = expectedValue,
test = (x: FileTreeParsingResult) => x.treeScanTask
)
def basePath(expectedValue: Path): HavePropertyMatcher[FileTreeParsingResult, Path] =
Helpers.propertyMatcher(
propertyName = "tree base path",
expected = expectedValue,
test = (x: FileTreeParsingResult) => x.treeScanTask.treeBasePath
)
def basePath(expectedValue: String): HavePropertyMatcher[FileTreeParsingResult, Path] =
basePath(Paths.get(expectedValue))
def treeType(expectedValue: TreeType): HavePropertyMatcher[FileTreeParsingResult, TreeType] =
Helpers.propertyMatcher(
propertyName = "file tree type",
expected = expectedValue,
test = (x: FileTreeParsingResult) => x.treeScanTask.treeType
)
def numParsingTasks(expectedValue: Long): HavePropertyMatcher[FileTreeParsingResult, Long] =
Helpers.propertyMatcher(
propertyName = "number of processed calculations",
expected = expectedValue,
test = (x: FileTreeParsingResult) => x.numCalculationsFound
)
def numFailedTasks(expectedValue: Long): HavePropertyMatcher[FileTreeParsingResult, Long] =
Helpers.propertyMatcher(
propertyName = "number of failed calculations",
expected = expectedValue,
test = (x: FileTreeParsingResult) => x.numParsingFailures
)
def outputPath(expectedValue: Path): HavePropertyMatcher[FileTreeParsingResult, Path] =
Helpers.propertyMatcher(
propertyName = "output location",
expected = expectedValue,
test = (x: FileTreeParsingResult) => x.outputLocation
)
def outputPath(expectedValue: String): HavePropertyMatcher[FileTreeParsingResult, Path] =
basePath(Paths.get(expectedValue))
def outputType(expectedValue: OutputType): HavePropertyMatcher[FileTreeParsingResult, OutputType] =
Helpers.propertyMatcher(
propertyName = "output format",
expected = expectedValue,
test = (x: FileTreeParsingResult) => x.outputFormat
)
}
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment