-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
33 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
test/org/mockitousage/bugs/deepstubs/DeepStubFailingWhenGenricNestedAsRawTypeTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package org.mockitousage.bugs.deepstubs; | ||
|
||
import static org.mockito.Mockito.RETURNS_DEEP_STUBS; | ||
import static org.mockito.Mockito.mock; | ||
import static org.mockito.Mockito.when; | ||
|
||
import org.junit.Test; | ||
|
||
public class DeepStubFailingWhenGenricNestedAsRawTypeTest { | ||
|
||
interface MyClass1<MC2 extends MyClass2> { | ||
MC2 getNested(); | ||
} | ||
|
||
interface MyClass2<MC3 extends MyClass3> { | ||
MC3 getNested(); | ||
} | ||
|
||
interface MyClass3 { | ||
String returnSomething(); | ||
} | ||
|
||
@Test | ||
public void discoverDeepMockingOfGenerics() { | ||
MyClass1 myMock1 = mock(MyClass1.class, RETURNS_DEEP_STUBS); | ||
when(myMock1.getNested().getNested().returnSomething()).thenReturn("Hello World."); | ||
} | ||
} |