I'm trying to get started with avro & avro4s and I'm running into trouble getting a silly example working.
I can't even get my own version of a test found in the source repo to compile - https://github.com/sksamuel/avro4s/blob/master/avro4s-core/src/test/scala/com/sksamuel/avro4s/AvroJsonInputTest.scala#L14-L20
I'm getting the error mentioned in the title could not find implicit value for parameter fromRecord: com.sksamuel.avro4s.FromRecord[Foo]
.
package test
import java.io.ByteArrayInputStream
import com.sksamuel.avro4s._
import org.specs2.mutable.Specification
class AvroSpec extends Specification {
"My classes" should {
"be deserialized by avro" in {
case class Foo(num: Int, name: String)
val json = """{ "num": 17, "name": "jibba-jabbba" }"""
val inst = Foo(num = 17, name = "jibba-jabba")
val in = new ByteArrayInputStream(json.getBytes("UTF-8"), 0, json.length)
val foo = new AvroJsonInputStream[Foo](in).iterator.toSet
in.close()
foo mustEqual Set(inst)
}
}
}
I'm using Scala 2.11.8 and avro 1.7.0. What am I doing wrong?