Closed manuelbernhardt closed 12 years ago
I've just tried this in a small test project, and it seems to work for me. Is there any chance you could make a small example that demonstrates the problem available?
Closing as have received no feedback - please feel free to reopen if you are still having the problem and can provide an example that demonstrates it.
Sorry for the late reply. I created a sample project here which should demonstrate the issue:
Apologies for the delay in looking at this. I just tried to build the project which illustrates the problem, and unfortunately it's failing with unresolved dependencies:
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: UNRESOLVED DEPENDENCIES ::
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: uk.org.mygrid.resources.jcoord#jcoord;1.0: not found
[warn] :: org.osgeo#proj4j;0.1.0: not found
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
I managed to track down a repository that has jcoord: http://build.mygrid.org.uk/maven/repository/
, but I can't find one that has proj4j anywhere?
Thanks Paul for trying this out, I now asked a colleague to check what is wrong on this end
I just updated the sample project with another repository that should contain the missing dependencies, if you could try again. Thanks!
Thanks Manuel - that works now, and I can reproduce the problem.
It looks like the issue is that the the constructor is going recursive during instantiation of the mock - I've not picked through the MappingEngine
code in enough detail to work out why, but the root cause is the fact that Mock$MappingEngine
inherits from MappingEngine
, and therefore its constructor is called when the mock is instantiated. The fix would be to generate mocks for not just directly mocked classes, but also for all the classes that they inherit from.
I'm afraid that, given that the compiler plugin has turned out to be a dead-end and ScalaMock 3 is moving to using macros instead, I'm probably not going to be able to justify the time that would be required to fix this :-(
Hi,
I'm trying to use a mock (using the compiler plugin) for a Java class that has no default constructor, but I get this when trying to initialize it via
mock[MappingEngine]
:Is there something special that needs to be done in this case?
Thanks,
Manuel