Comments (5)
This is expected behaviour because Scala doesn't allow a lazy val
to be overridden with a def
. It's possible that I might be able to make it work in ScalaMock4, however, which I've just started working on.
from scalamock.
This is now mentioned as a known limitation in the FAQ: http://scalamock.org/user-guide/faq/
from scalamock.
There is a comment from @paulbutcher on StackOverflow about scalameta making this possible. Is this now something that could be implemented?
from scalamock.
ScalaMeta is an interesting library but it will require significant rewrites to make use of it. ScalaMock relies on whitebox macros internally, which aren't exactly compatible and we'd need to transition away from that. Still worth looking at.
from scalamock.
a Scala val
cannot be overridden by a def
, so this feature doesn't fit into ScalaMock really, even with the potential use of ScalaMeta. Assuming the val
is not final, you can just subclass it yourself so i don't really see a strong argument for ScalaMock to provide special handling. Example:
class ClazzIWantToMock {
val thingIdlikeToOverride: Int = 5
}
class MockedClazz extends ClazzIWantToMock {
override val thingIdlikeToOverride= 99
}
from scalamock.
Related Issues (20)
- Mistake in scalamock documentation HOT 2
- Update to ScalaMock 5.1.0 breaks argument matching
- Is this project maintained anymore? HOT 4
- Scala 3 Support HOT 4
- Cannot mock class that uses the "pimp my library" pattern HOT 1
- Massive logs when mocked method relies on type class derivation HOT 1
- Specs2 Example Test Not Failing When Assertion Changed
- Verifying the number of invocations is unreliable HOT 1
- ScalaMock macro does not infer/resolve context-bound type-parameters correctly
- Documentation: Mocking 0-parameter function and parameterless function HOT 1
- explicit wrapping in withExpectations needed when working with specs2 Specification
- "Error while emitting" on wrong mock usage HOT 1
- Testing scala Parser and get `Parameter type in structural refinement may not refer to an abstract type defined outside that refinement`
- update github pages docs for scala 3
- Scala 3 PathDependent Mock issue HOT 2
- Scala 3 regression from Scala 2.13 expected a term symbol but received val <none> HOT 2
- Mocking Slick Table results in compile error HOT 5
- Scala3 Intersection Type Issue HOT 2
- union / intersection type and generic class issue HOT 3
- Mocking classes with constructor params with applied types fails
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 scalamock.