ScalaMock icon indicating copy to clipboard operation
ScalaMock copied to clipboard

Compilation error on mocking java class with varargs constructor

Open NersesAM opened this issue 6 years ago • 0 comments

ScalaMock Version 4.1.0

Scala Version 2.12

Runtime JVM

Please describe the expected behavior of the issue

trying to stub/mock a java class which accepts varargs in a constructor should work

Please provide a description of what actually happens

But compilation fails with the following message

[error]  found   : String*
[error]  required: String
[error]   val site         = stub[MyClass]
[error]                          ^

Reproducible Test Case

public class MyClass {
    public MyClass(String... varargs) {

    }
}
test("my failing test") {
  val s = stub[MyClass]
}

NersesAM avatar Aug 24 '18 09:08 NersesAM