@@ -5,16 +5,15 @@ import org.apache.avro.{Schema, SchemaNormalization}
5
5
import org .scalatest ._
6
6
import flatspec ._
7
7
import com .davideicardi .kaa .avro .{AvroBinarySerializer , AvroSingleObjectEncoding , AvroSingleObjectSerializer }
8
- import com .davideicardi .kaa .{SchemaId , SchemaRegistry }
8
+ import com .davideicardi .kaa .SchemaId
9
+ import com .davideicardi .kaa .test .TestSchemaRegistry
9
10
import matchers ._
10
11
11
- import scala .collection .mutable
12
-
13
12
case class Pokemon (name : String , mainType : String , offType : Option [String ], level : Int )
14
13
15
14
class AvroSingleObjectSerializerSpec extends AnyFlatSpec with should.Matchers {
16
15
17
- val registry = new SchemaRegistryFake
16
+ val registry = new TestSchemaRegistry
18
17
val dragonite = Pokemon (" Dragonite" , " Dragon" , None , 100 )
19
18
20
19
val singleObjectSerializer = new AvroSingleObjectSerializer [Pokemon ](registry)
@@ -42,20 +41,3 @@ class AvroSingleObjectSerializerSpec extends AnyFlatSpec with should.Matchers {
42
41
}
43
42
}
44
43
}
45
-
46
- class SchemaRegistryFake extends SchemaRegistry {
47
- val _schemas = new mutable.HashMap [SchemaId , Schema ]
48
-
49
- override def put (schema : Schema ): SchemaId = {
50
- val id = SchemaId (
51
- SchemaNormalization .parsingFingerprint64(schema)
52
- )
53
- _schemas.put(id, schema)
54
-
55
- id
56
- }
57
-
58
- override def get (id : SchemaId ): Option [Schema ] = {
59
- _schemas.get(id)
60
- }
61
- }
0 commit comments