Now willing to do integration test as below but problem is that
MerchantTier.executeUpdate('update MerchantTier..........'),
here update does not working
but if I make update with
def merchant = MerchantTier.get(params.id.toLong())
merchant.setValue(merchantTierVal)
instead of execute update it works
Is there is any prolem with executeUpdate Query?
def merchantTier
def setup() {
merchantTier = new MerchantTier(
startTier: tier,
endTier: tier,
value: 2.02).save(flush: true)
}
void "for given merchantTierId update merchantTier"(){
setup:
params = [id:merchantTier.id,tierVal:2]
when:
testData = updateIndividualSuperResellerTier(params)
then:"return data"
merchantTier.value==params.tierVal
}
def updateIndividualSuperResellerTier(params) {
def merchantTierVal = 0
if (params.tierVal) {
merchantTierVal = params.tierVal.toDouble()
}
def merchantTier = MerchantTier.get(params.id.toLong())
def updateMerchantTier = MerchantTier.executeUpdate('update MerchantTier mt set mt.value=:mrValue where mt.id=:mtId', [mrValue: merchantTierVal, mtId: params.id.toLong()])
}