I wrote a controller that tests if an image is valid, as in does it actually contain an image or is just a 1000 pixel square of nothing. It takes an image through a URL. It works fine but I can’t figure out how to write this unit test for the life of me. How would I mock a URL with image data? I have been digging around and can’t find an answer.
Share
A local file can be represented by a URL using the scheme
file://.So just save a test image locally accessible to your unit testref:
http://en.wikipedia.org/wiki/File_URI_scheme