Move fetchImage method to Util, add a test for it