forked from loafle/openapi-generator-original
updated sample
This commit is contained in:
parent
1e1d193556
commit
9cfbd8bde0
@ -1,5 +1,6 @@
|
||||
import com.wordnik.petstore.api._
|
||||
import com.wordnik.petstore.model._
|
||||
import io.swagger.client._
|
||||
import io.swagger.client.api._
|
||||
import io.swagger.client.model._
|
||||
|
||||
import org.junit.runner.RunWith
|
||||
import org.scalatest.junit.JUnitRunner
|
||||
@ -30,7 +31,7 @@ class PetApiTest extends FlatSpec with Matchers {
|
||||
Category(1, "sold"),
|
||||
"dragon",
|
||||
(for (i <- (1 to 10)) yield "http://foo.com/photo/" + i).toList,
|
||||
(for (i <- (1 to 5)) yield com.wordnik.petstore.model.Tag(i, "tag-" + i)).toList,
|
||||
(for (i <- (1 to 5)) yield io.swagger.client.model.Tag(i, "tag-" + i)).toList,
|
||||
"lost"
|
||||
)
|
||||
|
||||
@ -55,7 +56,7 @@ class PetApiTest extends FlatSpec with Matchers {
|
||||
Category(1, "sold"),
|
||||
"programmer",
|
||||
(for (i <- (1 to 10)) yield "http://foo.com/photo/" + i).toList,
|
||||
(for (i <- (1 to 5)) yield com.wordnik.petstore.model.Tag(i, "tag-" + i)).toList,
|
||||
(for (i <- (1 to 5)) yield io.swagger.client.model.Tag(i, "tag-" + i)).toList,
|
||||
"confused"
|
||||
)
|
||||
|
||||
@ -80,7 +81,7 @@ class PetApiTest extends FlatSpec with Matchers {
|
||||
}
|
||||
|
||||
it should "find pets by status" in {
|
||||
api.findPetsByStatus("available") match {
|
||||
api.findPetsByStatus(List("available")) match {
|
||||
case Some(pets) => {
|
||||
pets.foreach(pet => pet.status should be("available"))
|
||||
}
|
||||
@ -90,7 +91,7 @@ class PetApiTest extends FlatSpec with Matchers {
|
||||
|
||||
it should "find pets by tag" in {
|
||||
println("finding by tags")
|
||||
api.findPetsByTags("tag1,tag2") match {
|
||||
api.findPetsByTags(List("tag1", "tag2")) match {
|
||||
case Some(pets) => {
|
||||
pets.foreach(pet => {
|
||||
val tags = (for (tag <- pet.tags) yield tag.name).toSet
|
||||
|
@ -1,6 +1,6 @@
|
||||
import com.wordnik.client._
|
||||
import com.wordnik.petstore.api._
|
||||
import com.wordnik.petstore.model._
|
||||
import io.swagger.client._
|
||||
import io.swagger.client.api._
|
||||
import io.swagger.client.model._
|
||||
|
||||
import org.junit.runner.RunWith
|
||||
import org.scalatest.junit.JUnitRunner
|
||||
@ -30,13 +30,14 @@ class StoreApiTest extends FlatSpec with Matchers {
|
||||
}
|
||||
|
||||
it should "place an order" in {
|
||||
val now = new java.util.Date
|
||||
val now = new org.joda.time.DateTime
|
||||
val order = Order (
|
||||
10,
|
||||
1000,
|
||||
101,
|
||||
"pending",
|
||||
now)
|
||||
petId = 10,
|
||||
id = 1000,
|
||||
quantity = 101,
|
||||
status = "pending",
|
||||
shipDate = now,
|
||||
complete = true)
|
||||
|
||||
api.placeOrder(order)
|
||||
|
||||
@ -45,20 +46,21 @@ class StoreApiTest extends FlatSpec with Matchers {
|
||||
order.id should be(1000)
|
||||
order.petId should be(10)
|
||||
order.quantity should be(101)
|
||||
order.shipDate should be (now)
|
||||
order.shipDate.equals(now) should be (true)
|
||||
}
|
||||
case None =>
|
||||
}
|
||||
}
|
||||
|
||||
it should "delete an order" in {
|
||||
val now = new java.util.Date
|
||||
val now = new org.joda.time.DateTime
|
||||
val order = Order(
|
||||
1001,
|
||||
10,
|
||||
101,
|
||||
"pending",
|
||||
now)
|
||||
id = 1001,
|
||||
petId = 10,
|
||||
quantity = 101,
|
||||
status = "pending",
|
||||
shipDate = now,
|
||||
complete = true)
|
||||
|
||||
api.placeOrder(order)
|
||||
|
||||
@ -67,7 +69,7 @@ class StoreApiTest extends FlatSpec with Matchers {
|
||||
order.id should be(1001)
|
||||
order.petId should be(10)
|
||||
order.quantity should be(101)
|
||||
order.shipDate should be (now)
|
||||
order.shipDate.equals(now) should be (true)
|
||||
}
|
||||
case None =>
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
import com.wordnik.petstore.api._
|
||||
import com.wordnik.petstore.model._
|
||||
import io.swagger.client._
|
||||
import io.swagger.client.api._
|
||||
import io.swagger.client.model._
|
||||
|
||||
import org.junit.runner.RunWith
|
||||
import org.scalatest.junit.JUnitRunner
|
||||
|
Loading…
x
Reference in New Issue
Block a user