| Class Summary | |
trait
|
JUnit3Suite
extends junit.framework.TestCase with Suite
A suite of tests that can be run with either JUnit 3 or ScalaTest. This trait allows you to write JUnit 3 tests
with ScalaTest's more concise assertion syntax as well as JUnit's assertions (
assertEquals, etc.).
You create tests by defining methods that start with test, and can create fixtures with methods
named setUp and tearDown. For example:
import org.scalatest.junit.JUnit3Suite
import scala.collection.mutable.ListBuffer
class TwoSuite extends JUnit3Suite {
var sb: StringBuilder = _
var lb: ListBuffer[String] = _
override def setUp() {
sb = new StringBuilder("ScalaTest is ")
lb = new ListBuffer[String]
}
def testEasy() {
sb.append("easy!")
assert(sb.toString === "ScalaTest is easy!")
assert(lb.isEmpty)
lb += "sweet"
}
def testFun() {
sb.append("fun!")
assert(sb.toString === "ScalaTest is fun!")
assert(lb.isEmpty)
}
}
|