Skip to content

Commit

Permalink
Various test fixes prior to 9.2 publish.
Browse files Browse the repository at this point in the history
version bump to 9.3-SNAPSHOT
  • Loading branch information
rinmalavi committed Nov 12, 2014
1 parent 5df225e commit 7e58785
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 16 deletions.
2 changes: 1 addition & 1 deletion build.sbt
@@ -1,4 +1,4 @@
version := "0.9.2"
version := "0.9.3-SNAPSHOT"

name := "dsl-client-scala"

Expand Down
Expand Up @@ -11,7 +11,7 @@ class AuthHeaderTest extends Specification {
Header Provider is resolved from the ServiceLocator
provide with auth header $auth
provide with project id $pid
privide custom $custom
provide custom $custom
"""

private val withAuthHeader =
Expand Down
5 changes: 2 additions & 3 deletions http/src/test/scala/com/dslplatform/test/RootTest.scala
Expand Up @@ -24,9 +24,8 @@ class RootTest extends Specification with Common {

def justInstantiate = {
val sr = SimpleRoot(1, 2f, "3")
pending
//invalid now
sr.URI === null

sr.URI !== null
}

def persist = { implicit locator: ServiceLocator =>
Expand Down
19 changes: 8 additions & 11 deletions http/src/test/scala/com/dslplatform/test/SerializationTest.scala
Expand Up @@ -10,7 +10,7 @@ import org.joda.time.{DateTime, LocalDate}
import org.specs2._
import org.specs2.specification.Step

class SerializationTest extends Specification {
class SerializationTest extends Specification with Common {

def is = s2"""
JsonSerialization is used to serialize object for transport
Expand Down Expand Up @@ -43,9 +43,6 @@ class SerializationTest extends Specification {
val located = new Located
val jsonSerialization = located.resolved[JsonSerialization]

implicit val duration: scala.concurrent.duration.Duration = scala.concurrent.duration.Duration(10,
"seconds")

def resolve = { jsonSerialization: JsonSerialization =>
jsonSerialization.isInstanceOf[JsonSerialization] must beTrue
}
Expand Down Expand Up @@ -79,7 +76,7 @@ class SerializationTest extends Specification {
val cl = classOf[SimpleRoot]
val fld = cl.getDeclaredField("__locator")
fld.setAccessible(true)
(fld.get(simpleRoot) !== null)
fld.get(simpleRoot) !== null
}

def deserializeNonOptionalObjectsInAValue = { jsonSerialization: JsonSerialization =>
Expand All @@ -104,25 +101,25 @@ class SerializationTest extends Specification {
def enumSerializeDeserializeFromServer = { implicit locator: ServiceLocator => //404
val root = SimpleRoot(e = E.B)
val srRepo = locator.resolve[PersistableRepository[SimpleRoot]]
srRepo.insert(root)
val rootURI = await(srRepo.insert(root))
(root.e === E.B) & {
val remote = SimpleRoot.find(root.URI)
val remote = SimpleRoot.find(rootURI)
remote.e === E.B
}
}

def deserializeNonOptionalObjectsInASnowflake = { jsonSerialization: JsonSerialization =>
val dtd = jsonSerialization.deserialize[snowDTD]("{}".getBytes("UTF-8"))
dtd.T.withMillis(0) === DateTime.now().withMillis(0)
dtd.D === BigDecimal(0)
dtd.DT === LocalDate.now()
(dtd.D === BigDecimal(0)) &
(dtd.DT === LocalDate.now())
}

def deserializeNonOptionalObjectsInAnEvent = { jsonSerialization: JsonSerialization =>
val dtd = jsonSerialization.deserialize[EveDTD]("{}".getBytes("UTF-8"))
dtd.T.withMillis(0) === DateTime.now().withMillis(0)
dtd.D === BigDecimal(0)
dtd.DT === LocalDate.now()
(dtd.D === BigDecimal(0)) &
(dtd.DT === LocalDate.now())
}

def doubleDeserialization = { jsonSerialization: JsonSerialization =>
Expand Down

0 comments on commit 7e58785

Please sign in to comment.