if (methods.length > 0) {
Object o = context.getTest().invoke(methods[0]);
if (o != null && o instanceof Mockery) {
return (Mockery) o;
}
throw new TestPluginException("Method '%s' annotated with @MockContextProvider did not returned a valid Mockery object: %s", methods[0], o);
}
}
{
Field[] fields = context.getTest().getFieldsAnnotatedWith(MockContextProvider.class);
if (fields.length > 0) {
Object o = context.getTest().get(fields[0]);
if (o != null && o instanceof Mockery) {
return (Mockery) o;
}
throw new TestPluginException("Field '%s' annotated with @MockContextProvider does not have a valid Mockery object: %s", fields[0], o);
}
}
return null;
}