Loading a boot image of a test module application in Java

I am doing image loading as described in the documentation for the App Engine image APIs, using getServingUrl () to create the URL to load, and then redirecting the request to my own handler. I am wondering if there is a good way to modulate testing the image processing logic in my handler. If I create an instance of my handler in unit test and pass a request to it, it fails with "Must be called from blob load callback request". Can I somehow mock him?

+4
source share
1 answer

Write a mock that returns a known value from the getServingUrl method, and then make sure your class reads that value correctly and uses it to execute the load request. You must assume that in this case the GAE code will do the right thing. The only logic you should relate to is that it reads this url from GAE and subsequently sends its blob data to it.

+2
source

Source: https://habr.com/ru/post/1398188/


All Articles