Skip to content

Commit

Permalink
test classes to companion objects
Browse files Browse the repository at this point in the history
  • Loading branch information
kubinio123 committed Mar 25, 2021
1 parent 63c9130 commit 59359cc
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ import io.circe.Codec
import io.circe.generic.auto._
import org.scalatest.funsuite.AnyFunSuite
import org.scalatest.matchers.should.Matchers
import sttp.tapir._
import sttp.tapir.docs.openapi.VerifyYamlCoproductTest._
import sttp.tapir.generic.auto._
import sttp.tapir.json.circe.jsonBody
import sttp.tapir.openapi.Info
import sttp.tapir.openapi.circe.yaml._
import sttp.tapir.tests.{Entity, Organization, Person}
import sttp.tapir._

class VerifyYamlCoproductTest extends AnyFunSuite with Matchers {
test("should match expected yaml for coproduct with enum field") {
Expand Down Expand Up @@ -122,6 +122,14 @@ class VerifyYamlCoproductTest extends AnyFunSuite with Matchers {
}

object VerifyYamlCoproductTest {
sealed trait GenericEntity[T]
case class GenericPerson[T](data: T) extends GenericEntity[T]

sealed trait Clause
case class Expression(v: String) extends Clause
case class Not(not: Clause) extends Clause
case class NestedEntity(entity: Entity)

object Color extends Enumeration {
type Color = Value

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import io.circe.generic.auto._
import org.scalatest.funsuite.AnyFunSuite
import org.scalatest.matchers.should.Matchers
import sttp.model.StatusCode
import sttp.tapir.docs.openapi.VerifyYamlOneOfTest._
import sttp.tapir.generic.auto._
import sttp.tapir.json.circe.jsonBody
import sttp.tapir.openapi.Info
Expand Down Expand Up @@ -69,3 +70,10 @@ class VerifyYamlOneOfTest extends AnyFunSuite with Matchers {
}

}

object VerifyYamlOneOfTest {
sealed trait ErrorInfo
case class NotFound(what: String) extends ErrorInfo
case class Unauthorized(realm: String) extends ErrorInfo
case class Unknown(code: Int, msg: String) extends ErrorInfo
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import sttp.tapir.openapi.circe.yaml._
import sttp.tapir.openapi._
import sttp.tapir.tests.{Person, _}
import sttp.tapir.{Endpoint, endpoint, _}
import VerifyYamlTest._

import java.time.{Instant, LocalDateTime}

Expand Down Expand Up @@ -445,26 +446,9 @@ class VerifyYamlTest extends AnyFunSuite with Matchers {
}
}

case class F1(data: List[F1])
case class G[T](data: T)

case class NestedEntity(entity: Entity)

sealed trait ErrorInfo
case class NotFound(what: String) extends ErrorInfo
case class Unauthorized(realm: String) extends ErrorInfo
case class Unknown(code: Int, msg: String) extends ErrorInfo

case class ObjectWrapper(value: FruitAmount)

sealed trait GenericEntity[T]
case class GenericPerson[T](data: T) extends GenericEntity[T]

case class ObjectWithList(data: List[FruitAmount])
case class ObjectWithStrings(data: List[String])

sealed trait Clause
case class Expression(v: String) extends Clause
case class Not(not: Clause) extends Clause

case class MyClass(myAttribute: Int)
object VerifyYamlTest {
case class F1(data: List[F1])
case class G[T](data: T)
case class ObjectWrapper(value: FruitAmount)
case class ObjectWithList(data: List[FruitAmount])
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import sttp.tapir.json.circe._
import sttp.tapir.openapi.Info
import sttp.tapir.openapi.circe.yaml._
import sttp.tapir.tests._
import VerifyYamlValidatorTest._

class VerifyYamlValidatorTest extends AnyFunSuite with Matchers {

Expand Down Expand Up @@ -202,3 +203,9 @@ class VerifyYamlValidatorTest extends AnyFunSuite with Matchers {
}

}

object VerifyYamlValidatorTest {
case class ObjectWithList(data: List[FruitAmount])
case class ObjectWithStrings(data: List[String])
case class MyClass(myAttribute: Int)
}

0 comments on commit 59359cc

Please sign in to comment.