@@ -549,11 +549,26 @@ class JsonCodecMakerSpec extends VerifyingSpec {
549
549
implicit val levelOrdering : Ordering [Level ] = new Ordering [Level ] {
550
550
override def compare (x : Level , y : Level ): Int = y.ordinal - x.ordinal
551
551
}
552
- val codecOfOrderedLevelTreeMap = make[_root_.scala.collection.immutable.TreeMap [Level , Int ]]
553
- verifySerDeser(codecOfOrderedLevelTreeMap,
552
+ verifySerDeser(make[_root_.scala.collection.immutable.TreeMap [Level , Int ]],
554
553
_root_.scala.collection.immutable.TreeMap [Level , Int ](Level .HIGH -> 100 , Level .LOW -> 10 ), """ {"0":10,"1":100}""" )
555
- verifyDeserByCheck(codecOfOrderedLevelTreeMap , """ {"0":10,"1":100}""" ,
554
+ verifyDeserByCheck(make[_root_.scala.collection.immutable. TreeMap [ Level , Int ]] , """ {"0":10,"1":100}""" ,
556
555
check = (actual : _root_.scala.collection.immutable.TreeMap [Level , Int ]) => actual.ordering shouldBe levelOrdering)
556
+ verifySerDeser(make[_root_.scala.collection.immutable.SortedMap [Level , Int ]],
557
+ _root_.scala.collection.immutable.SortedMap [Level , Int ](Level .HIGH -> 100 , Level .LOW -> 10 ), """ {"0":10,"1":100}""" )
558
+ verifyDeserByCheck(make[_root_.scala.collection.immutable.SortedMap [Level , Int ]], """ {"0":10,"1":100}""" ,
559
+ check = (actual : _root_.scala.collection.immutable.SortedMap [Level , Int ]) => actual.ordering shouldBe levelOrdering)
560
+ verifySerDeser(make[_root_.scala.collection.mutable.TreeMap [Level , Int ]],
561
+ _root_.scala.collection.mutable.TreeMap [Level , Int ](Level .HIGH -> 100 , Level .LOW -> 10 ), """ {"0":10,"1":100}""" )
562
+ verifyDeserByCheck(make[_root_.scala.collection.mutable.TreeMap [Level , Int ]], """ {"0":10,"1":100}""" ,
563
+ check = (actual : _root_.scala.collection.mutable.TreeMap [Level , Int ]) => actual.ordering shouldBe levelOrdering)
564
+ verifySerDeser(make[_root_.scala.collection.mutable.SortedMap [Level , Int ]],
565
+ _root_.scala.collection.mutable.SortedMap [Level , Int ](Level .HIGH -> 100 , Level .LOW -> 10 ), """ {"0":10,"1":100}""" )
566
+ verifyDeserByCheck(make[_root_.scala.collection.mutable.SortedMap [Level , Int ]], """ {"0":10,"1":100}""" ,
567
+ check = (actual : _root_.scala.collection.mutable.SortedMap [Level , Int ]) => actual.ordering shouldBe levelOrdering)
568
+ verifySerDeser(make[_root_.scala.collection.SortedMap [Level , Int ]],
569
+ _root_.scala.collection.SortedMap [Level , Int ](Level .HIGH -> 100 , Level .LOW -> 10 ), """ {"0":10,"1":100}""" )
570
+ verifyDeserByCheck(make[_root_.scala.collection.SortedMap [Level , Int ]], """ {"0":10,"1":100}""" ,
571
+ check = (actual : _root_.scala.collection.SortedMap [Level , Int ]) => actual.ordering shouldBe levelOrdering)
557
572
}
558
573
" serialize and deserialize types using a custom value codec and a custom ordering for set values" in {
559
574
implicit val codecOfLevel : JsonValueCodec [Level ] = new JsonValueCodec [Level ] {
@@ -574,11 +589,26 @@ class JsonCodecMakerSpec extends VerifyingSpec {
574
589
implicit val levelOrdering : Ordering [Level ] = new Ordering [Level ] {
575
590
override def compare (x : Level , y : Level ): Int = y.ordinal - x.ordinal
576
591
}
577
- val codecOfOrderedLevelTreeSet = make[_root_.scala.collection.immutable.TreeSet [Level ]]
578
- verifySerDeser(codecOfOrderedLevelTreeSet,
592
+ verifySerDeser(make[_root_.scala.collection.immutable.TreeSet [Level ]],
579
593
_root_.scala.collection.immutable.TreeSet [Level ](Level .HIGH , Level .LOW ), """ [0,1]""" )
580
- verifyDeserByCheck(codecOfOrderedLevelTreeSet , """ [0,1]""" ,
594
+ verifyDeserByCheck(make[_root_.scala.collection.immutable. TreeSet [ Level ]] , """ [0,1]""" ,
581
595
check = (actual : _root_.scala.collection.immutable.TreeSet [Level ]) => actual.ordering shouldBe levelOrdering)
596
+ verifySerDeser(make[_root_.scala.collection.immutable.SortedSet [Level ]],
597
+ _root_.scala.collection.immutable.SortedSet [Level ](Level .HIGH , Level .LOW ), """ [0,1]""" )
598
+ verifyDeserByCheck(make[_root_.scala.collection.immutable.SortedSet [Level ]], """ [0,1]""" ,
599
+ check = (actual : _root_.scala.collection.immutable.SortedSet [Level ]) => actual.ordering shouldBe levelOrdering)
600
+ verifySerDeser(make[_root_.scala.collection.mutable.TreeSet [Level ]],
601
+ _root_.scala.collection.mutable.TreeSet [Level ](Level .HIGH , Level .LOW ), """ [0,1]""" )
602
+ verifyDeserByCheck(make[_root_.scala.collection.mutable.TreeSet [Level ]], """ [0,1]""" ,
603
+ check = (actual : _root_.scala.collection.mutable.TreeSet [Level ]) => actual.ordering shouldBe levelOrdering)
604
+ verifySerDeser(make[_root_.scala.collection.mutable.SortedSet [Level ]],
605
+ _root_.scala.collection.mutable.SortedSet [Level ](Level .HIGH , Level .LOW ), """ [0,1]""" )
606
+ verifyDeserByCheck(make[_root_.scala.collection.mutable.SortedSet [Level ]], """ [0,1]""" ,
607
+ check = (actual : _root_.scala.collection.mutable.SortedSet [Level ]) => actual.ordering shouldBe levelOrdering)
608
+ verifySerDeser(make[_root_.scala.collection.SortedSet [Level ]],
609
+ _root_.scala.collection.SortedSet [Level ](Level .HIGH , Level .LOW ), """ [0,1]""" )
610
+ verifyDeserByCheck(make[_root_.scala.collection.SortedSet [Level ]], """ [0,1]""" ,
611
+ check = (actual : _root_.scala.collection.SortedSet [Level ]) => actual.ordering shouldBe levelOrdering)
582
612
}
583
613
" serialize and deserialize enumerations" in {
584
614
verifySerDeser(codecOfEnums1, Enums (LocationType .GPS ), """ {"lt":"GPS"}""" )
0 commit comments