Comments (14)
@erikvanoosten Yes!, but I have to wait for my depencencies to be released compiled for RC2 (so far cats-core is the missing one).
I'll release a version supporting RC2 as soon as all my dependencies do :)
from mockito-scala.
@smarter it works as expected
Thanks!
from mockito-scala.
@gslowikowski Interesting, I'll take a look over the weekend
from mockito-scala.
@gslowikowski it seems to be a problem with the compiler not handling final methods correctly, I've reported it here.
In the meantime, you can use inline-mocking as a workaround.
inline-mocking uses a different stubber that allows to mock final methods and classes, but is still not the default in Mockito as it doesn't support 100% of the use cases and feedback from the community is still being collected.
To enable it, just create a simple text file test/resources/mockito-extensions/org.mockito.plugins.MockMaker
that just contains the text mock-maker-inline
.
Let's hope RC2 or the final version includes a fix for this.
from mockito-scala.
Thank you @bbonanno
from mockito-scala.
Update: PR that should fix this issue here
from mockito-scala.
To try this PR, you can set scalaVersion := 2.13.0-pre-02f59fb-SNAPSHOT
after adding to your build:
resolvers += "scala-integration" at
"https://scala-ci.typesafe.com/artifactory/scala-pr-validation-snapshots/",
Would be interested in knowing if everything works with that.
from mockito-scala.
@smarter It was a wise call, it works for the simple example in the PR, but it doesn't in a more complex scenario, I couldn't figure out what type of hierarchy creates it, but if you run
java.lang.reflect.Modifier.isFinal(classOf[scala.reflect.io.AbstractFile].getMethod("toIterable").getModifiers)
it yields true
, which causes everything to blow up
from mockito-scala.
@bbonanno Once a version of the scala-library compiled with the fixed scala-compiler is published, this should fix itself.
from mockito-scala.
@smarter Fair enough, I'll give it a go as son as RC2 is released
Thanks for your help!
from mockito-scala.
The following should work:
scalaVersion := 2.13.0-pre-cf9468e
resolvers += "scala-integration" at
"https://scala-ci.typesafe.com/artifactory/scala-integration/",
from mockito-scala.
2.13.0-RC2 is already out :)
from mockito-scala.
cats-core 2.0.0-M2 for Scala 2.13.0-RC2 is released!
https://search.maven.org/artifact/org.typelevel/cats-core_2.13.0-RC2/2.0.0-M2/jar
from mockito-scala.
Fixed by #112
from mockito-scala.
Related Issues (20)
- When Stubbing function call it throws cannot be cast to org.apache.spark.sql.Dataset java.lang.ClassCastException: HOT 3
- Have mockObject in async tests return a future HOT 2
- Session fails if tests override the default executionContext
- by-name parameters incorrectly evaluated when mocking HOT 1
- verify number of invocations with `times` is broken HOT 2
- 'this' is not available when debugging
- mockito-scala error `value thenAnswer is not a member of Nothing`
- Mockito won't stub method as expected if the method implemented with Singleton pattern.
- Mockito and Swagger - unsafe symbol ApiModelProperty (child of package annotations) in runtime reflection universe
- tag missing problem
- withObjectSpied call real method instead of stubbed HOT 1
- mockito-scala does not work with mockito 4.8.0 and above HOT 1
- Vulnerability CVE-2022-36944
- InvalidUseOfMatchersException on java 19 in presence of default arguments
- 'Illegal reflective access operation has occurred' using WithObjectMocked
- Misidentifies final overload as bridge, tries to override final method
- Cannot invoke "cats.effect.IO.map(scala.Function1)" because "fa" is null
- jdk21: use latest mockito-core as dependency for updated bytebuddy HOT 5
- Mockito cannot mock this class: class scala.xml.Elem HOT 1
- jdk21 support issue HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mockito-scala.