Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
unit testing HTTP4s encoders
package httpServices
import io.circe.Printer
import org.http4s.circe.CirceInstances
import org.scalatest.{FlatSpec, Matchers}
import org.http4s.dsl._
class ExampleEncoderTest extends FlatSpec with Matchers {
case class TestObject(someValue: Int, someOptionalValue:Option[Int])
object Encoders extends CirceInstances {
override protected def defaultPrinter: Printer = Printer.noSpaces.copy(dropNullKeys = true)
implicit val schedulesEncoder = jsonEncoderOf[TestObject]
it should "Test the Encoders Object concisely!" in {
import Encoders._
Ok(TestObject(5, None)).as[String].unsafePerformSync shouldEqual
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment