Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
Michael Bannister
@michaelbannister
Hi Marcin, thanks again for the fast response on the Java 6 compatibility issue.
I've identified the further problem I was having. My test involves a @Subject which is a Spy, and I stub a method which is called internally which would otherwise throw an exception (when run out-of-container). When the subject is managed by your extension, the stubbing is ignored, the original method is invoked and I get an exception.
I have created a failing spec which demonstrates this: https://gist.github.com/michaelbannister/afce6c6a5ad22649ffea
I'd be very grateful for any thoughts on why this is and whether the extension can be modified to allow stubbing/partial-mocking on a Spy, or whether the way it works is just not compatible.
Thanks!
Marcin Grzejszczak
@marcingrzejszczak
Hi! It's incompatible with my approach since I'm instantiating the class and either by constructor, setter or a property try to inject your collaborator to a subject. If you're creating a spy then I'm just ignoring this and normally instantiating an object. I would have to for example check if you haven't already created a spy and if that is the case I would have to omit the object instantation.
Marcin Grzejszczak
@marcingrzejszczak
But to tell you the truth I think I know how to solve this ;) I'll try to release a version today
BTW I encourage to fill out the testimonials wiki page - https://github.com/marcingrzejszczak/spock-subjects-collaborators-extension/wiki/Testimonials :)
Marcin Grzejszczak
@marcingrzejszczak
@michaelbannister - so... does it work? :P
Michael Bannister
@michaelbannister
I had only a couple of minutes to try This morning but I think so – Many thanks! I'll test a bit more at the weekend and feed back :)
Michael Bannister
@michaelbannister
Thanks again – I can confirm this is working very nicely for me! That eliminates the one thing I think my team might grumble about when I get everyone to move to Groovy/Spock instead of Java/Mockito.
Marcin Grzejszczak
@marcingrzejszczak
@michaelbannister - nice to hear that! :)
Marcin Grzejszczak
@marcingrzejszczak
Marcin Grzejszczak
@marcingrzejszczak
@all - since version 1.1.0 the extension is available also at Maven Central! Enjoy :)
Ashish Meshram
@ashishjmeshram
Hi
Marcin Grzejszczak
@marcingrzejszczak
hello
Ashish Meshram
@ashishjmeshram
so I know constructor injection will work
But is there any way I can this work?
Marcin Grzejszczak
@marcingrzejszczak
of course
show me the two other classes
and I'll see what I can do about this ;)
Ashish Meshram
@ashishjmeshram
is there any way to upload files here ?
Marcin Grzejszczak
@marcingrzejszczak
yeah you can drag and drop
you can also paste them
you can use markdown
Ashish Meshram
@ashishjmeshram
Oh Okay
Marcin Grzejszczak
@marcingrzejszczak
GenericDAOImpl too please
Ashish Meshram
@ashishjmeshram
Here you go !
Marcin Grzejszczak
@marcingrzejszczak
ok thx
Ashish Meshram
@ashishjmeshram
I really appreciate you trying to help me out here
Marcin Grzejszczak
@marcingrzejszczak
np - give me a sec - I'll write a test