Ky
07/15/2022, 5:57 PMabstract class CombineTask : DefaultTask() {
@get:Option(option = "csvFolder", description = "Absolute path of folder containing CSV's")
@get:Input
abstract val csvFolder: Property<String>
@get:Option(
option = "outputFile",
description = "Name of output file, generated in \"csvFolder\" directory"
)
@get:Input
abstract val outputFileString: Property<String>
@get:Internal
lateinit var outputFile: File
@get:Internal
val csvFiles = mutableListOf<File>()
/**
* Prepare for combining & Configure output location
*/
@TaskAction
fun handleFiles() {
// do stuff
}
Then I have a test class
class CombineTests {
@BeforeEach
fun setup() {}
@Test
fun testFiles() {
val file1 = File("path").createParser()
val file2 = File("path").createParser()
assertEquals(file1, file2)
}
}
The script is executed as ./gradlew combineTask --csvFolder="path" --outputFile="something.csv"
Is there a way to possibly call an exec
block in the test and then assert if exception was thrown or not? I'm unsure on proper way to test this type of task