Skip to content

Commit

Permalink
Add failing test
Browse files Browse the repository at this point in the history
  • Loading branch information
hughsimpson committed Aug 1, 2024
1 parent d3596e0 commit 51feb59
Showing 1 changed file with 18 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package org.scalamock.test.scalatest

import org.scalamock.scalatest.MockFactory
import org.scalatest.flatspec.AnyFlatSpec
import org.scalatest.matchers.should.Matchers

class AbstractOverrideMethodTest extends AnyFlatSpec with Matchers with MockFactory {
class A extends B with D
trait B extends C { def foo(): Int = 1 }
trait C { def foo(): Int }
trait D extends C { abstract override def foo(): Int = super.foo() * 2 }

"ScalaTest suite" should "permit mocking classes build with stackable trait pattern" in {
val mockedClass = mock[A]
(mockedClass.foo _).expects().returning(42)
mockedClass.foo() shouldBe 42
}
}

0 comments on commit 51feb59

Please sign in to comment.