-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1219 from mockito/regression-test-1174
Add regression test for issue #1174
- Loading branch information
Showing
1 changed file
with
36 additions
and
0 deletions.
There are no files selected for viewing
36 changes: 36 additions & 0 deletions
36
src/test/java/org/mockitousage/bugs/GenericsMockitoAnnotationsTest.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,36 @@ | ||
package org.mockitousage.bugs; | ||
|
||
import org.junit.Before; | ||
import org.junit.Test; | ||
import org.mockito.Mock; | ||
|
||
import java.util.ArrayList; | ||
import java.util.Collection; | ||
|
||
import static org.mockito.BDDMockito.given; | ||
import static org.mockito.MockitoAnnotations.initMocks; | ||
|
||
/** | ||
* This was an issue reported in #1174. | ||
*/ | ||
public class GenericsMockitoAnnotationsTest { | ||
|
||
@Mock | ||
private TestCollectionSourceProvider testCollectionSourceProvider; | ||
|
||
@Test | ||
public void should_not_throw_class_cast_exception() { | ||
given(testCollectionSourceProvider.getCollection(new ArrayList<Integer>())).willReturn(new ArrayList<Integer>()); | ||
} | ||
|
||
static class TestCollectionSourceProvider { | ||
<T extends Collection<E>, E> T getCollection(T collection) { | ||
return collection; | ||
} | ||
} | ||
|
||
@Before | ||
public void setUp() throws Exception { | ||
initMocks(this); | ||
} | ||
} |