Created
December 7, 2011 03:00
-
-
Save seratch/1441243 to your computer and use it in GitHub Desktop.
Fixing the conflict of org.hamcrest.Matchers and org.mockito.Mathers
This file contains hidden or 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
| package tools; | |
| import static org.mockito.Matchers.*; | |
| /** | |
| * Problem: cannot compile the following code | |
| * | |
| * <pre> | |
| * import static org.hamcrest.Matchers.*; | |
| * import static org.mockito.Matchers.*; | |
| * when(myService.getSomething(any(HttpSession.class)).thenReturn("something"); | |
| * </pre> | |
| */ | |
| public class MockitoMatchers { | |
| @SuppressWarnings("unchecked") | |
| public static <T> T mockitoAny(Class<T> clazz) { | |
| return (T) anyObject(); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment