Вопрос

I am trying to do a partial mock using Spock Spy. Here is code that works:

setup:
Bulk bulk = new Bulk()
bulk.setApi(stub)           
when:
bulk.updateHeldBounsedSubscribers(subscribers, bounceEvents)

and here is the code that does not work:

setup:
Bulk bulk = Spy(Bulk)
bulk.getSubscribersByKeys(_) >> subs
bulk.setApi(stub)           
when:
bulk.updateHeldBounsedSubscribers(subscribers, bounceEvents)

It produces following exception:

groovy.lang.MissingMethodException: No signature of method: com.otpp.email.BulkEmailDownloader$$EnhancerByCGLIB$$8227f19f.updateHeldBounsedSubscribers() is applicable for argument types: (java.util.ArrayList, java.util.LinkedHashMap) values: [[com.exacttarget.wsdl.partnerapi.Subscriber@57a41eae], ...]
at com.otpp.email.DownloaderUnitTests.updateHeldBounsedSubscribers test with mocked API objects(DownloaderUnitTests.groovy:223)
Это было полезно?

Решение

The method was private. I changed it to protected and it works.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top