Exception during macro expansion in mockito-scala-scalatest
See original GitHub issueContext (Environment)
Running unit tests with following dependencies:
- Scala v2.11.12
- Gradle v5.6
- mockito-scala-scalatest_2.11 v1.14.3
- scalatest_2.11 v3.0.5
- spark-sql_2.11 v2.4.3
Here is the test script:
import org.mockito.scalatest.MockitoSugar
class MyTest extends FunSuite with MockitoSugar {
test("should return something") {
// given
val mySpy = spy(new MySpy)
when(mySpy.doSomething(any, any)).thenReturn(new DataFrame(...))
// when
val actual = mySpy.myMethod("some-string")
// then
val expected = new DataFrame(...)
assert(expected === actual)
Expected Behavior
Tests should be running without any exceptions thrown.
Current Behavior
Failed to load ApplicationContext while initializing embedded database.
Error:(43, 11) exception during macro expansion:
java.lang.NoSuchMethodError: org.scalactic.BooleanMacro.<init>(Lscala/reflect/macros/whitebox/Context;Ljava/lang/String;)V
at org.scalatest.AssertionsMacro$.assert(AssertionsMacro.scala:34)
assert(expected === actual)
Assumption
Dependency conflicts
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
exception during macro expansion error with openjdk11, sbt ...
I'm receiving a lot of errors [error] /root/something-updates/src/main/scala/Something.scala:67:92: exception during macro expansion: ...
Read more >exception during macro expansion - Google Groups
Hi Chung, I think you hit the problem between Scala 2.11.2 and our assert macro. Scala 2.11.2 has some kind of incompatible change...
Read more >`exception during macro expansion: [error] scala.reflect ...
I am already requiring ctx as an implicit variable, so I can't import it as well. You don't need to import a context...
Read more >getquill/quill - Gitter
I'm getting exception during macro expansion: [error] java.lang.InstantiationError: com.typesafe.scalalogging.Logger [error] at com.typesafe.scalalogging.
Read more >Macro expansion - Guide to Rustc Development
With few exceptions, we use this method on the whole crate (see "Eager Expansion" below for more detailed discussion of edge case expansion...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
you’r assumption was right, you’re using an old version of Scalatest, update to “3.1.2” and the problem goes away
I just wanted to add my resolution to this issue when changing from strictly mockito-core to mockito-scala. I had to add
"org.scalactic" %% "scalactic" % "3.0.3" % "test"
to mydependencyOverrides
. I am not currently able to updatescalatest
past3.0.4
and am on scala version2.11.12