I'm using spring boot MVC and want to test my service class using spock. I'm running into an issue however with instantiating a mock object however, and get the following error:
public static Object invokeMethod(Object target, Method method, Object... args) {
try {
return method.invoke(target, args);
} catch (IllegalAccessException var4) {
ExceptionUtil.sneakyThrow(var4);
return null;
} catch (InvocationTargetException var5) {
**ExceptionUtil.sneakyThrow(var5.getCause());**
return null;
}
}
With the line that has the ** being the cause of my issue. I'm not sure why this is occurring however. Below is what I'm doing.
@Autowired
MyService myService
def "deleting"(){
given "creating a basic object with uuid"
ObjectDefinition object = Mock()
myService.saveNewObject(object)
}
Where ObjectDefinition is an abstract class, and inside of the MyService class I have a data access object to talk to the database as well. Why do I keep getting the following error when I try running this piece of code, and what do I need to do to fix it?
Aucun commentaire:
Enregistrer un commentaire