/** * Scenario: Server returns a client error (HTTP 404). * * <p>Verify that: * Situation is treated as unrecoverable (UnrecoverableDownloadContentException) */ @Test(expected = BaseAction.UnrecoverableDownloadContentException.class) public void testClientErrorsAreUnrecoverable() throws Exception { HttpClient client = mockHttpClient(404, ""); File temporaryFile = mock(File.class); doReturn(false).when(temporaryFile).exists(); DownloadAction action = spy(new DownloadAction(null)); action.download(client, TEST_URL, temporaryFile); verify(client).execute(any(HttpUriRequest.class)); }