Skip to content

Instantly share code, notes, and snippets.

@Zuchos
Created October 17, 2018 07:21
Show Gist options
  • Save Zuchos/d71ece9ca976175021dc31e5544ce147 to your computer and use it in GitHub Desktop.
Save Zuchos/d71ece9ca976175021dc31e5544ce147 to your computer and use it in GitHub Desktop.
import org.scalatest.{BeforeAndAfterEach, FlatSpecLike, Suite}
trait BaseSpec extends Suite with BeforeAndAfterEach {
override protected def beforeEach(): Unit = {
super.beforeEach()
println("Before Each Base Spec")
}
}
abstract class ExtendedBaseSpec(val name:String) extends BaseSpec {
override protected def beforeEach(): Unit = {
super.beforeEach()
println(s"Before Extended Spec - $name")
}
}
class ExampleSpec extends ExtendedBaseSpec("ExampleSpec") with FlatSpecLike {
override protected def beforeEach(): Unit = {
super.beforeEach()
println("Before Each Example spec")
}
it should "test" in {
assert(condition = true)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment