Reputation: 896
import org.scalatest.fixture.Suite.OneArgTest
class PingPongActorSpec extends TestKit(ActorSystem("PingPongActorSpec"))
with ImplicitSender with FlatSpecLike with Matchers with BeforeAndAfterAll {
override def withFixture(test: OneArgTest) = {}
}
When I am trying to override withFixture method with test of type 'OneArgTest' the compiler is giving me following error messages:
Upvotes: 1
Views: 1068
Reputation: 748
You need to use org.scalatest.flatspec.FixtureFlatSpecLike
import org.scalatest.flatspec.FixtureFlatSpecLike
class PingPongActorSpec extends TestKit(ActorSystem("PingPongActorSpec"))
with ImplicitSender with FixtureFlatSpecLike with Matchers with BeforeAndAfterAll { ...
Upvotes: 1
Reputation: 896
Instead of mixing in trait "FlatSpecLike":
class PingPongActorSpec extends TestKit(ActorSystem("PingPongActorSpec"))
with ImplicitSender with FlatSpecLike with Matchers with BeforeAndAfterAll {
override def withFixture(test: OneArgTest) = {}
}
We need to mix trait "fixture.FlatSpecLike":
class PingPongActorSpec extends TestKit(ActorSystem("PingPongActorSpec"))
with ImplicitSender with fixture.FlatSpecLike with Matchers with BeforeAndAfterAll
override def withFixture(test: OneArgTest) = {}
}
This resolve the issue.
Upvotes: 1
Reputation: 5424
Just remove your import. OneArgTest
is an inner protected trait in Suite
trait, so it can be used in descendants of Suite without import. This
should work:
class PingPongActorSpec extends TestKit(ActorSystem("PingPongActorSpec"))
with ImplicitSender with FlatSpecLike with Matchers with BeforeAndAfterAll {
override def withFixture(test: OneArgTest) = {}
}
Upvotes: 0