I have a service class and a method in it where I am calling another method in case the first method gives back an error. I have made every effort to test this simple scenario but spock test would not cover the onError
For Ex: Lets Assume ServiceA is my service interface class
ServiceAImpl implements ServiceA {
public Method1 () {
SomemethodBeingCalled().onError(e->SecondMethodtohandleError())
}
private SomemethodBeingCalled(){}
private SecondMethodtohandleError(){}
}
How do test using Spock so that I can cover the onError(e->SecondMethodtohandleError() block ?