如何調用下面的方法def只傳遞interactionId,transactionId,awResponseFile,testMethodName和expectedNumberOfConsumers?Groovy默認方法參數
方法高清
void verifyPersistence(String interactionId, String transactionId,
File rawResponseFile, String testMethodName,
int expectedNumberOfDatasourceProductResponseRaws=1,
String dsProductName=datasourceSpec['creditreport.name'],
int expectedNumberOfDatasourceProductResponses=1,
int expectedNumberOfConsumers=1,
int expectedNumberOfAddresses=1)
方法調用
verifyPersistence interactionId.persistedVersion(), transactionId,
results, testName.methodName, expectedNumberOfConsumers:8
異常
groovy.lang.MissingMethodException: No signature of method: verifyPersistence() is applicable for argument types: (java.util.LinkedHashMap, java.lang.String, java.lang.String, java.io.File, java.lang.String) values: [[expectedNumberOfConsumers:8], 3130001030065, 10003000000890059, C:\results, multiple consumers contracts]
Possible solutions:
verifyPersistence(java.lang.String, java.lang.String, java.io.File, java.lang.String),
verifyPersistence(java.lang.String, java.lang.String, java.io.File, java.lang.String, int),
verifyPersistence(java.lang.String, java.lang.String, java.io.File, java.lang.String, int, java.lang.String),
verifyPersistence(java.lang.String, java.lang.String, java.io.File, java.lang.String, int, java.lang.String, int), verifyPersistence(java.lang.String, java.lang.String, java.io.File, java.lang.String, int, java.lang.String, int, int)
at HitmultipleconsumersPersistSpec.groovy:151)
是不可能將其他參數作爲'null'傳遞? – iberbeu 2013-03-07 20:41:21
@iberbeu no。其他人仍應採用def方法中提供的默認值。你知道我做錯了什麼嗎? – 2013-03-07 20:42:19
它看起來像第一個參數應該是'String',但是你引入了'LinkedHashMap''你確定'interactionId.persistedVersion()'返回一個String而不是'LinkedHashMap' – iberbeu 2013-03-07 20:46:55