use of org.mockito.internal.util.reflection.GenericMaster in project mockito by mockito.
the class CaptorAnnotationProcessor method process.
@Override
public Object process(Captor annotation, Field field) {
Class<?> type = field.getType();
if (!ArgumentCaptor.class.isAssignableFrom(type)) {
throw new MockitoException("@Captor field must be of the type ArgumentCaptor.\n" + "Field: '" + field.getName() + "' has wrong type\n" + "For info how to use @Captor annotations see examples in javadoc for MockitoAnnotations class.");
}
Class<?> cls = new GenericMaster().getGenericType(field);
return ArgumentCaptor.forClass(cls);
}
use of org.mockito.internal.util.reflection.GenericMaster in project powermock by powermock.
the class AnnotationEnabler method processAnnotationOn.
private Object processAnnotationOn(Captor annotation, Field field) {
Class<?> type = field.getType();
if (!ArgumentCaptor.class.isAssignableFrom(type)) {
throw new MockitoException("@Captor field must be of the type ArgumentCaptor.\n" + "Field: '" + field.getName() + "' has wrong type\n" + "For info how to use @Captor annotations see examples in javadoc for MockitoAnnotations class.");
}
Class cls = new GenericMaster().getGenericType(field);
return ArgumentCaptor.forClass(cls);
}
Aggregations