I'm trying to use scalatest to test an App like this:
object Main extends App {
val name = "Greg"
}
class JunkTests extends FunSpec with MustMatchers {
describe("Junk Tests") {
it("Junk-1 -- Must do stuff") {
println("Name: "+Main.name)
// some test here
}
}
}
My name output is always null. How can I get my main object going to use its facilities during a test? In actual use I have an App that's an Http server and I want to send it messages, but right now its never initialized so the server is never started. This simple example shows that Main is never initialized.