paulbutcher / ScalaMock

Native Scala mocking framework
http://scalamock.org/
MIT License
501 stars 98 forks source link

Mocking classes with constructor params with applied types fails #519

Open martijnhoekstra opened 1 month ago

martijnhoekstra commented 1 month ago

ScalaMock Version (e.g. 3.5.0)

6.0.0

Scala Version (e.g. 2.12)

3.3.3

Runtime (JVM or JS)

JVM

Please describe the expected behavior of the issue

mocking classes with generic parameters works as expected

Please provide a description of what actually happens

compilation fails, with

Found:    Option
Required: Option[Int]

Reproducible Test Case

Please provide a minimised code snippet that fails, ideally, written as a failing test case in ScalaTest. This will help us a lot in diagnosing the problem and work on a fix. If the issue is more complex or requires configuration, please provide a link to a project on Github that reproduces the issue.

import org.scalamock.scalatest.MockFactory
import org.scalatest.funsuite.AnyFunSuite

class Example(opt: Option[Int])
class ReallySimpleExampleTest extends AnyFunSuite with MockFactory {
  test("example") {
    mock[Example]
  }
}

https://scastie.scala-lang.org/5NtYSNzkTImhshrePP6Mzg