I want to add some constants to my Spek test to hold the filenames of some resource files that the tests will access like this.
What is the idiomatic way to do this?
In JUnit, I would declare a static final
value. But in Spek, I can't even use the typical kotlin idoim of a companion object
to hold them as Spek tests are objects themselves, which can't have companions. I can't even mark them as const
as I get the error "Modifier 'const' is not applicable to 'local variable'.
So is there any better or more preferred way than this:
object MyTest : Spek({
val SAMPLE_GRAPH_FILENAME1 = "sample_graph1.png"
val SAMPLE_GRAPH_FILENAME2 = "sample_graph2.png"
val SAMPLE_OTHER_FILENAME = "sample_data.txt"
// test code
})