This leads me to a new question, I have a custom gradle task that is executed via command line with ...
k
This leads me to a new question, I have a custom gradle task that is executed via command line with arguments. This custom gradle task lives in my buildSrc directory...
Copy code
abstract 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
Copy code
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