Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

add other scala TestCase samples (via Specs and by "extends TestCase"…

… (old way))
  • Loading branch information...
commit 3defd7bb265b6a527f194e8cde738dc302fca746 1 parent bb0a31b
David Bernard authored June 11, 2010 davidB committed June 20, 2010
2  samples/prj-java-test-in-scala/pom.xml
@@ -17,14 +17,12 @@
17 17
       <version>4.8.1</version>
18 18
       <scope>test</scope>
19 19
     </dependency>
20  
-    <!-- 
21 20
     <dependency>
22 21
 		  <groupId>org.scala-tools.testing</groupId> 
23 22
 		  <artifactId>specs_2.8.0.Beta1</artifactId> 
24 23
 		  <version>1.6.4</version> 
25 24
       <scope>test</scope>
26 25
     </dependency>
27  
-    -->
28 26
   </dependencies>
29 27
 
30 28
   <build>
15  samples/prj-java-test-in-scala/src/test/scala/samples/Calculator2Test.scala
... ...
@@ -0,0 +1,15 @@
  1
+package samples
  2
+
  3
+import org.junit.Assert._
  4
+import junit.framework.TestCase
  5
+
  6
+class Calculator2Test extends TestCase {
  7
+
  8
+  def test_ok() = assertTrue(true)
  9
+
  10
+  def test_basicSum() = {
  11
+    val subject = new Calculator()
  12
+    assertEquals(10, subject.sum(5, 5))
  13
+    assertEquals(10, subject.sum(1, 9))
  14
+  }
  15
+}
12  samples/prj-java-test-in-scala/src/test/scala/samples/SpecsTest.scala
... ...
@@ -0,0 +1,12 @@
  1
+package samples
  2
+
  3
+import org.specs._
  4
+
  5
+class SpecsTest extends SpecificationWithJUnit {
  6
+  "'hello world' has 11 characters" in {
  7
+     "hello world".size must_== 11
  8
+  }
  9
+  "'hello world' matches 'h.* w.*'" in {
  10
+     "hello world" must be matching("h.* w.*")
  11
+  }
  12
+}

0 notes on commit 3defd7b

Please sign in to comment.
Something went wrong with that request. Please try again.