Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added first test for `expectedTestCount()` for `HelloWorldUnitSpec` demo

  • Loading branch information...
commit 5f5a0f7b46ec48bbed99c7624de468986634aa49 1 parent 1198255
@rlegendi authored
View
2  TODO.md
@@ -2,3 +2,5 @@ TODO
====
- Fix classpath entries, they are absolute path entries at the moment!
+- Is the examples accessible in any binary build? That way we should'nt need duplicate example code in the tests.
+
View
40 src/test/scala/org/scalatest/specs2/HelloWorldUnitSpecTest.scala
@@ -0,0 +1,40 @@
+package org.scalatest.specs2
+
+import org.junit.runner.RunWith
+import org.scalatest.Filter
+import org.scalatest.Style
+import org.scalatest.WrapWith
+import org.specs2.mutable
+import org.specs2.runner.JUnitRunner
+
+// This is the unit specification under test
+class HelloWorldUnitSpec extends mutable.Specification {
+
+ "The 'Hello world' string" should {
+ "contain 11 characters" in {
+ "Hello world" must have size (11)
+ }
+ "start with 'Hello'" in {
+ "Hello world" must startWith("Hello")
+ }
+ "end with 'world'" in {
+ "Hello world" must endWith("world")
+ }
+ }
+
+}
+
+@RunWith(classOf[JUnitRunner])
+@WrapWith(classOf[MutableSpec2Runner])
+class HelloWorldUnitSpecTest extends mutable.Specification {
+
+ val runner = MutableSpec2Runner(classOf[HelloWorldUnitSpec])
+
+ "When executing 'HelloWorldUnitSpec' the runner" should {
+ "find 3 examples" in {
+ val noFilter = new Filter(None, Set.empty[String])
+ runner.expectedTestCount(noFilter) must be_==(3)
+ }
+ }
+
+}
Please sign in to comment.
Something went wrong with that request. Please try again.