I have the ff. test method:
@Mock
private DBAccessor accessor;
/**
* Successful find().
*/
@Test
public void testFind() {
// Prepare
MockDto mockDto = mock(MockDto.class);
try {
when(accessor.executeQuery(any(Class.class), anyString(), any(ConcurrentHashMap.class))).thenReturn(
mockDto);
} catch (Exception e) {
fail("Unexpected exception.");
}
}
However, the ff. warning occcurs:
Multiple markers at this line
- Type safety: Unchecked invocation executeQuery(Class, String, ConcurrentHashMap) of the generic method executeQuery(Class<T>, String, Object) of type DBAccessor
- Type safety: The expression of type Class needs unchecked conversion to conform to Class<Object>
How do I resolve the above warnings?
I'm using Mockit and Powermock as mocking frameworks and JUnit.