Im trying to get a simple test working from the description on the Lagom docs. However a the code is not compiling. How should I read this error and what do i need to fix it?
object DataCollectorService {
val TOPIC_NAME = "tweets"
}
trait DataCollectorService extends Service {
override def descriptor: Descriptor = {
import Service._
named("tweet").withCalls(
call(getTweet)
).withTopics(
topic(DataCollectorService.TOPIC_NAME, tweetsTopic)
).withAutoAcl(true)
}
// REST handlers
def getTweet: ServiceCall[String, String]
// Topic handler
def tweetsTopic(): Topic[TweetMessage]
}
case class TweetMessage(message: String)
object TweetMessage {
implicit val format: Format[TweetMessage] = Json.format[TweetMessage]
}"The PublishService" should {
"publish events on the topic" in ServiceTest.withServer(ServiceTest.defaultSetup) { ctx =>
new DataCollectorApplication(ctx) with LocalServiceLocator
with TestTopicComponents
} { server =>
implicit val system = server.actorSystem
implicit val mat = server.materializer
val client: DataCollectorService = server.serviceClient.implement[DataCollectorService]
val source = client.tweetsTopic().subscribe.atMostOnceSource
source.runWith(TestSink.probe[TweetMessage])
.request(1)
.expectNext should ===(TweetMessage("msg 1"))
}
}Error:(16, 11) <$anon: org.mlpipeline.impl.DataCollectorApplication with com.lightbend.lagom.scaladsl.server.LocalServiceLocator with com.lightbend.lagom.scaladsl.testkit.TestTopicComponents> inherits conflicting members:
lazy value topicFactory in trait LagomKafkaClientComponents of type com.lightbend.lagom.internal.scaladsl.api.broker.TopicFactory and
lazy value topicFactory in trait TestTopicComponents of type com.lightbend.lagom.internal.scaladsl.api.broker.TopicFactory
(Note: this can be resolved by declaring an override in <$anon: org.mlpipeline.impl.DataCollectorApplication with com.lightbend.lagom.scaladsl.server.LocalServiceLocator with com.lightbend.lagom.scaladsl.testkit.TestTopicComponents>.)
new DataCollectorApplication(ctx) with LocalServiceLocator