From 6058ff399e1f493fad9ecdfddcb5c27cf81a3a3b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20=C5=A0pan=C4=9Bl?= Date: Wed, 11 Nov 2020 14:54:42 +0100 Subject: [PATCH] ADT test no longer needs JSON special case handling --- .../borer/derivation/DerivationSpec.scala | 33 ++++++++----------- 1 file changed, 14 insertions(+), 19 deletions(-) diff --git a/derivation/src/test/scala/io/bullet/borer/derivation/DerivationSpec.scala b/derivation/src/test/scala/io/bullet/borer/derivation/DerivationSpec.scala index 84cf5ce6..4b9ab141 100644 --- a/derivation/src/test/scala/io/bullet/borer/derivation/DerivationSpec.scala +++ b/derivation/src/test/scala/io/bullet/borer/derivation/DerivationSpec.scala @@ -428,26 +428,21 @@ abstract class DerivationSpec(target: Target) extends AbstractBorerSpec { "ADT" - { import ADT._ - try { - implicit val dogCodec = deriveCodec[Dog] - implicit val catCodec = deriveCodec[Cat] - implicit val mouseCodec = deriveCodec[Mouse] - implicit val animalCodec = deriveCodec[Animal] - - val animals: List[Animal] = List( - Dog(12, "Fred"), - Cat(weight = 1.0, color = "none", home = "there"), - Dog(4, "Lolle"), - Mouse(true) - ) + implicit val dogCodec = deriveCodec[Dog] + implicit val catCodec = deriveCodec[Cat] + implicit val mouseCodec = deriveCodec[Mouse] + implicit val animalCodec = deriveCodec[Animal] - val encoded = encode(animals) - decode[Element](encoded) ==> mapBasedAnimalsDom - decode[List[Animal]](encoded) ==> animals - } catch { - case NonFatal(e) if target == Json => - e.getMessage ==> "JSON does not support integer values as a map key (Output.ToByteArray index 124)" - } + val animals: List[Animal] = List( + Dog(12, "Fred"), + Cat(weight = 1.0, color = "none", home = "there"), + Dog(4, "Lolle"), + Mouse(true) + ) + + val encoded = encode(animals) + decode[Element](encoded) ==> mapBasedAnimalsDom + decode[List[Animal]](encoded) ==> animals } "ADT Key Collision" - {