Skip to content

Commit 419e565

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

File tree

1 file changed

+14
-20
lines changed

1 file changed

+14
-20
lines changed

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

Lines changed: 14 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ import io.bullet.borer._
1212
import utest._
1313

1414
import scala.util.{Failure, Try}
15-
import scala.util.control.NonFatal
1615

1716
abstract class DerivationSpec(target: Target) extends AbstractBorerSpec {
1817
import Dom._
@@ -428,26 +427,21 @@ abstract class DerivationSpec(target: Target) extends AbstractBorerSpec {
428427
"ADT" - {
429428
import ADT._
430429

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-
)
430+
implicit val dogCodec = deriveCodec[Dog]
431+
implicit val catCodec = deriveCodec[Cat]
432+
implicit val mouseCodec = deriveCodec[Mouse]
433+
implicit val animalCodec = deriveCodec[Animal]
443434

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-
}
435+
val animals: List[Animal] = List(
436+
Dog(12, "Fred"),
437+
Cat(weight = 1.0, color = "none", home = "there"),
438+
Dog(4, "Lolle"),
439+
Mouse(true)
440+
)
441+
442+
val encoded = encode(animals)
443+
decode[Element](encoded) ==> mapBasedAnimalsDom
444+
decode[List[Animal]](encoded) ==> animals
451445
}
452446

453447
"ADT Key Collision" - {

0 commit comments

Comments
 (0)