Skip to content

Commit 6058ff3

Browse files
committed
ADT test no longer needs JSON special case handling
1 parent 12aa6a9 commit 6058ff3

File tree

1 file changed

+14
-19
lines changed

1 file changed

+14
-19
lines changed

derivation/src/test/scala/io/bullet/borer/derivation/DerivationSpec.scala

Lines changed: 14 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -428,26 +428,21 @@ abstract class DerivationSpec(target: Target) extends AbstractBorerSpec {
428428
"ADT" - {
429429
import ADT._
430430

431-
try {
432-
implicit val dogCodec = deriveCodec[Dog]
433-
implicit val catCodec = deriveCodec[Cat]
434-
implicit val mouseCodec = deriveCodec[Mouse]
435-
implicit val animalCodec = deriveCodec[Animal]
436-
437-
val animals: List[Animal] = List(
438-
Dog(12, "Fred"),
439-
Cat(weight = 1.0, color = "none", home = "there"),
440-
Dog(4, "Lolle"),
441-
Mouse(true)
442-
)
431+
implicit val dogCodec = deriveCodec[Dog]
432+
implicit val catCodec = deriveCodec[Cat]
433+
implicit val mouseCodec = deriveCodec[Mouse]
434+
implicit val animalCodec = deriveCodec[Animal]
443435

444-
val encoded = encode(animals)
445-
decode[Element](encoded) ==> mapBasedAnimalsDom
446-
decode[List[Animal]](encoded) ==> animals
447-
} catch {
448-
case NonFatal(e) if target == Json =>
449-
e.getMessage ==> "JSON does not support integer values as a map key (Output.ToByteArray index 124)"
450-
}
436+
val animals: List[Animal] = List(
437+
Dog(12, "Fred"),
438+
Cat(weight = 1.0, color = "none", home = "there"),
439+
Dog(4, "Lolle"),
440+
Mouse(true)
441+
)
442+
443+
val encoded = encode(animals)
444+
decode[Element](encoded) ==> mapBasedAnimalsDom
445+
decode[List[Animal]](encoded) ==> animals
451446
}
452447

453448
"ADT Key Collision" - {

0 commit comments

Comments
 (0)