Skip to content

Conversation

szpak
Copy link
Member

@szpak szpak commented Dec 11, 2015

Simple change to prevent "Cannot assign 'Object' to 'MyClassToMock'" warning in Idea when the following construction is used:

MyClassToMock mock = Stub()

Spock infers stub/mock type from left-hand side anyway, so it is only a better syntax to express it (like already used for example in thrown()). This change should not break existing code.

Maybe there was some (unknown for me reason) to use just Object and in that case please let me know.

To prevent "Cannot assign 'Object' to 'MyClassToMock'" warning in Idea.
@mariuszs
Copy link

👍

@Fuud
Copy link
Contributor

Fuud commented Dec 14, 2015

seems good

@szpak
Copy link
Member Author

szpak commented Feb 2, 2016

@robfletcher @leonard84 @sbglasius Any chance to get my little change merged?

@sbglasius
Copy link
Member

+1 on the merge

@leonard84
Copy link
Member

Interesting I didn't know that you could do that without a either a Class<T> parameter, a T parameter or having a generic class with T.

leonard84 added a commit that referenced this pull request Feb 2, 2016
Enhance Mock()/Stub()/Spy() signature to support generic return types
@leonard84 leonard84 merged commit bf61631 into spockframework:master Feb 2, 2016
@szpak szpak deleted the tech/enhancedMockSignature branch February 2, 2016 21:32
@robfletcher robfletcher modified the milestone: 1.1-rc-1 Aug 24, 2016
szpak added a commit to szpak/spock that referenced this pull request Dec 23, 2017
szpak added a commit to szpak/spock that referenced this pull request Dec 23, 2017
szpak added a commit to szpak/spock that referenced this pull request Dec 23, 2017
leonard84 pushed a commit that referenced this pull request Jan 3, 2018
* Switch mock creation to simpler 1.1 syntax (fix #608)
   See #560 for details.
* MockDetector -> MockUtil in docs
* Mention Byte Buddy for proxy creation
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants