我在Microsoft365Offer中有readCSV()方法,我已经嘲笑了。但由于这个原因,我无法创建Microsoft365Offer类的对象。
GroovyMock(Microsoft365Offer, global: true)
Microsoft365Offer.readCSV(_,_) >> {
Microsoft365Offer microsoft365Offer = new Microsoft365Offer(
"name" : "any thing as product name",
"offerURI" : "4A-FAEA24541538",
"resellerPrice" : 1.6,
"fob" : 1.41,
"includedQuantities" : 0,
"minimumValue" : 0,
"taxesPISD" : 0,
"defaultTaxesISS" : 0)
println "=====coming in here========$microsoft365Offer"
return ["1":microsoft365Offer ]
}
输出=====来到这里======== null
我如何解决这个问题?提前谢谢。
答案 0 :(得分:0)
我找不到解决方案,但问题的解决方法是:
Microsoft365Offer microsoft365Offer = new Microsoft365Offer(
"name" : "any thing as product name",
"offerURI" : "4A-FAEA24541538",
"resellerPrice" : 1.6,
"fob" : 1.41,
"includedQuantities" : 0,
"minimumValue" : 0,
"taxesPISD" : 0,
"defaultTaxesISS" : 0)
GroovyMock(Microsoft365Offer, global: true)
Microsoft365Offer.readCSV(_,_) >> {
println "=====coming in here========$microsoft365Offer"
return ["1":microsoft365Offer]
}