What is a protected def ? I’d like to override the test method in my test case class so that it simply prints a prolog and epilog before running tests. Is protected there to keep me from doing that?
I’m creating test cases like the following.
import org.scalatest._
class MapColoringTestSuite extends FunSuite {
import MapColoring._
test("coloring") { ... do some testing stuff ...}
}
When I examine the code for test I find it is defined like this
trait FunSuiteLike extends TestSuite with TestRegistration with Informing with Notifying with Alerting with Documenting { thisSuite =>
/// ... stuff deleted
protected def test(testName: String, testTags: Tag*)(testFun: => Any /* Assertion */)(implicit pos: source.Position): Unit = { ...}
}
How can I override test in my local class MapColoringTestSuite so that it prints something which encoded the testName string, but then passes its arguments testName and testTags on to the next most applicable test method?
In place of passing testFun, I’d like to pass something like {println(s"testing $testName") ;testFun; println(s"finished $testName")}. How to make sure that the existence of my override method does not interfere with the implicit argument in the next method?