Did you tried to make this test red first? I'm pretty sure you can get an error response (ie: 404) with a correct InputStream. You should check the type of response somehow.