Hello guys,
Well I have created some keywords, but I have faced a problem. I have created API method which fills a model.
for example method:
public Collateral_JsonModel callCollateral(Integer id)
and it is based on this:
@ToString
class LoanCollateral_JsonModel {
String id
String typeid
String address
String typeName
}
Well the problem is, when I call this method, I am not sure that it will give me a response, it can give me as a response: or some data [… , …, …, etc.]
When I try to execute this script:
def getIDFromDB = Methods.getLoanIDs('1122155')
println getIDFromDB
APIClass api = new APIClass()
for(int i = 0; i < getIDFromDB.size(); i++) {
Collateral_JsonModel collateral = api.callCollateral(getIDFromDB[i])
}
if there is one id which gives me as response, it goes on an error:
Test Cases/New Test Case (3) FAILED.
Reason:
groovy.lang.GroovyRuntimeException: Could not find matching constructor
How can I make so that, put some logic if an api will give me an empty response to avoid such a problem ?