this is how im mocking my service call and returning a fake result:
when(myService.doSomething("",fakeRequestAsModel)) thenReturn fakeResult
val result = call(controller.myActionMethod(), request)
the problem is in the controller method myActionMethod
when I call doSomething
and passing the arguments im calling some property that that will only return something in production...
def myActionMethod() ... = {
myService.doSomething(request.getSomeValue,requestAsModel)
...
}
so, getSomeValue
is a method i can call only in production, it comes with a 3rd party library and I cant override it.
How can I still mock this call so request.getSomeValue
wont throw me an exception?
and request.getSomeValue
is dynamic, I cant unfortunately put it in configuration...