Giter Club home page Giter Club logo

Comments (14)

ultrasecreth avatar ultrasecreth commented on July 20, 2024 3

@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.

ultrasecreth avatar ultrasecreth commented on July 20, 2024 1

@smarter it works as expected

Thanks!

from mockito-scala.

ultrasecreth avatar ultrasecreth commented on July 20, 2024

@gslowikowski Interesting, I'll take a look over the weekend

from mockito-scala.

ultrasecreth avatar ultrasecreth commented on July 20, 2024

@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.

gslowikowski avatar gslowikowski commented on July 20, 2024

Thank you @bbonanno

from mockito-scala.

ultrasecreth avatar ultrasecreth commented on July 20, 2024

Update: PR that should fix this issue here

from mockito-scala.

smarter avatar smarter commented on July 20, 2024

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.

ultrasecreth avatar ultrasecreth commented on July 20, 2024

@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.

smarter avatar smarter commented on July 20, 2024

@bbonanno Once a version of the scala-library compiled with the fixed scala-compiler is published, this should fix itself.

from mockito-scala.

ultrasecreth avatar ultrasecreth commented on July 20, 2024

@smarter Fair enough, I'll give it a go as son as RC2 is released

Thanks for your help!

from mockito-scala.

smarter avatar smarter commented on July 20, 2024

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.

erikvanoosten avatar erikvanoosten commented on July 20, 2024

2.13.0-RC2 is already out :)

from mockito-scala.

magnolia-k avatar magnolia-k commented on July 20, 2024

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.

ultrasecreth avatar ultrasecreth commented on July 20, 2024

Fixed by #112

from mockito-scala.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.