Permalink
Browse files

Upgrade tests to junit 4 so that sbt will run them.

  • Loading branch information...
stephenh committed Dec 7, 2010
1 parent bc3d880 commit c60c65731eb0eba54bddeeea77e785fb031ad9f4
View
@@ -19,6 +19,7 @@
<dependency org="org.mortbay.jetty" name="jetty" rev="6.1.19" conf="buildtime->default;test->default;sources->sources"/>
<dependency org="com.google.code.typica" name="typica" rev="1.5.2a" conf="test->default;sources->sources"/>
- <dependency org="junit" name="junit" rev="3.8.1" conf="test->default;sources->sources"/>
+ <dependency org="junit" name="junit" rev="4.8.2" conf="test->default;sources->sources"/>
+ <dependency org="com.novocode" name="junit-interface" rev="0.4.0" conf="test->default;sources->sources"/>
</dependencies>
</ivy-module>
View
@@ -0,0 +1,11 @@
+<ivysettings>
+ <settings defaultResolver="default"/>
+ <include url="${ivy.default.settings.dir}/ivysettings-public.xml"/>
+ <resolvers>
+ <ibiblio name="bryanjswift" m2compatible="true" root="http://repos.bryanjswift.com/maven2/"/>
+ <chain name="default">
+ <resolver ref="bryanjswift"/>
+ <resolver ref="public"/>
+ </chain>
+ </resolvers>
+</ivysettings>
@@ -1,17 +1,18 @@
package fakesdb
-import junit.framework.TestCase
+import org.junit._
import com.xerox.amazonws.sdb.ItemAttribute
import com.xerox.amazonws.sdb.SimpleDB
-abstract class AbstractFakeSdbTest extends TestCase {
+abstract class AbstractFakeSdbTest {
// typica does not respect ports 9999
// val sdb = new SimpleDB(System.getenv("AWS_ACCESS_KEY_ID"), System.getenv("AWS_SECRET_ACCESS_KEY"), false)
val sdb = new SimpleDB("ignored", "ignored", false, "127.0.0.1")
val domaina = sdb.getDomain("domaina")
- override def setUp(): Unit = {
+ @Before
+ def setUp(): Unit = {
flush()
}
@@ -1,15 +1,17 @@
package fakesdb
-import junit.framework.Assert._
+import org.junit._
+import org.junit.Assert._
import com.xerox.amazonws.sdb.ItemAttribute
class BatchPutAttributesTest extends AbstractFakeSdbTest {
- override def setUp(): Unit = {
- flush()
+ @Before
+ def createDomain(): Unit = {
sdb.createDomain("domaina")
}
+ @Test
def testPut(): Unit = {
val as = new java.util.ArrayList[ItemAttribute]()
as.add(new ItemAttribute("a", "1", true))
@@ -1,15 +1,17 @@
package fakesdb
-import junit.framework.Assert._
+import org.junit._
+import org.junit.Assert._
import com.xerox.amazonws.sdb.ItemAttribute
class DeleteAttributesTest extends AbstractFakeSdbTest {
- override def setUp(): Unit = {
- flush()
+ @Before
+ def createDomain(): Unit = {
sdb.createDomain("domaina")
}
+ @Test
def testDeleteOneEntireAttribute(): Unit = {
add(domaina, "itema", "a" -> "1", "b" -> "2")
@@ -25,6 +27,7 @@ class DeleteAttributesTest extends AbstractFakeSdbTest {
assertEquals("b", now.get(0).getName)
}
+ @Test
def testDeleteBothAttributesDeletesTheItem(): Unit = {
add(domaina, "itema", "a" -> "1", "b" -> "2")
@@ -39,6 +42,7 @@ class DeleteAttributesTest extends AbstractFakeSdbTest {
assertEquals(0, domaina.listItems.getItemList.size)
}
+ @Test
def testDeleteNoAttributesDeletesTheItem(): Unit = {
add(domaina, "itema", "a" -> "1", "b" -> "2")
@@ -1,14 +1,16 @@
package fakesdb
-import junit.framework.Assert._
+import org.junit._
+import org.junit.Assert._
class DomainMetadataTest extends AbstractFakeSdbTest {
- override def setUp(): Unit = {
- super.setUp
+ @Before
+ def createDomain(): Unit = {
sdb.createDomain("domaina")
}
+ @Test
def testFoo(): Unit = {
add(domaina, "itema", "aa" -> "111", "bb" -> "222", "bb" -> "333")
@@ -1,6 +1,6 @@
package fakesdb
-import junit.framework.Assert._
+import org.junit.Assert._
import com.xerox.amazonws.sdb.ItemAttribute
import com.xerox.amazonws.sdb.SimpleDB
@@ -1,9 +1,11 @@
package fakesdb
-import junit.framework.Assert._
+import org.junit._
+import org.junit.Assert._
class FlushDomainsTest extends AbstractFakeSdbTest {
+ @Test
def testFoo(): Unit = {
// Start with a flush
sdb.createDomain("_flush")
@@ -1,14 +1,16 @@
package fakesdb
-import junit.framework.Assert._
+import org.junit._
+import org.junit.Assert._
class GetAttributesTest extends AbstractFakeSdbTest {
- override def setUp(): Unit = {
- super.setUp
+ @Before
+ def createDomain(): Unit = {
sdb.createDomain("domaina")
}
+ @Test
def testGetMultipleValues(): Unit = {
add(domaina, "itema", "a" -> "1", "a" -> "2", "b" -> "3")
val attrs = domaina.getItem("itema").getAttributes
@@ -21,6 +23,7 @@ class GetAttributesTest extends AbstractFakeSdbTest {
assertEquals("3", attrs.get(2).getValue)
}
+ @Test
def testGetOneAttribute(): Unit = {
add(domaina, "itema",
"a" -> "1",
@@ -35,6 +38,7 @@ class GetAttributesTest extends AbstractFakeSdbTest {
assertEquals("1", attrs.get(0).getValue)
}
+ @Test
def testGetAttributesDoesNotCreateAnItem(): Unit = {
val attrs = domaina.getItem("itema").getAttributes
assertEquals(0, attrs.size)
@@ -1,9 +1,11 @@
package fakesdb
-import junit.framework.Assert._
+import org.junit._
+import org.junit.Assert._
class ListDomainsTest extends AbstractFakeSdbTest {
+ @Test
def testFoo(): Unit = {
sdb.createDomain("domain1")
sdb.createDomain("domain2")
@@ -1,14 +1,16 @@
package fakesdb
-import junit.framework.Assert._
+import org.junit._
+import org.junit.Assert._
class PutAttributesTest extends AbstractFakeSdbTest {
- override def setUp(): Unit = {
- super.setUp
+ @Before
+ def createDomain(): Unit = {
sdb.createDomain("domaina")
}
+ @Test
def testPutOne(): Unit = {
add(domaina, "itema", "a" -> "1")
val attrs = domaina.getItem("itema").getAttributes
@@ -17,6 +19,7 @@ class PutAttributesTest extends AbstractFakeSdbTest {
assertEquals("1", attrs.get(0).getValue)
}
+ @Test
def testPutMultipleValues(): Unit = {
add(domaina, "itema", "a" -> "1", "a" -> "2")
val attrs = domaina.getItem("itema").getAttributes
Oops, something went wrong.

0 comments on commit c60c657

Please sign in to comment.