Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

illegal inheritance, how to design my hierarchy to create my UnitSpec

I'm trying to create a BaseSpec class for my unit testing like so:

abstract class FunSpecBase extends FunSpec with BeforeAndAfter

trait GuiceBase extends ScalaModule {
  def configure() {
    bind[userDao].to[UserDaoImpl]
    // more here
  }
}

abstract class UnitBase extends FunSpecBase with GuiceBase

class UnitSpec extends UnitBase

When I run my test in sbt I get the error:

illegal inheritance; superclass FunSpecBase
[error]  is not a subclass of the superclass ScalaModule
[error]  of the mixin trait GuiceBase
[error] abstract class UnitBase extends FunSpecBase with GuiceBase
[error]                                                  ^
[error] one error found

Is it possible to work around this scenerio?

like image 916
Blankman Avatar asked Oct 31 '22 22:10

Blankman


1 Answers

maybe you want:

trait GuiceBase extends ScalaModule {
  def configure() {
    // bind[userDao].to[UserDaoImpl]
    // more here
  }
}

abstract class UnitBase extends GuiceBase with FunSpecLike

class UnitSpec extends UnitBase
like image 147
Klaus Avatar answered Nov 15 '22 05:11

Klaus