Suppose I have the following method structure:
protected static void sub(Object obj, String filler) {
class cls = obj.getClass();
BeanInfo beanInfo = Introspector.getBeanInfo(cls);
// Other code...
}
How do I mock the BeanInfo class given this structure?
Move this logic to separate method:
static BeanInfo beanInfo(Object obj) {
Class cls = obj.getClass();
BeanInfo beanInfo = Introspector.getBeanInfo(cls);
}
and then mock beanInfo
method.