### Question:
DownloadResponder { public void respond() { LOGGER.entering(); managedArtifact = downloadRequestProcessor.getArtifact(this.pathInfo); contents = managedArtifact.getArtifactContents(); setResponseMetadata(); try { IOUtils.copy(new ByteArrayInputStream(contents), httpServletResponse.getOutputStream()); } catch (IOException e) { throw new ArtifactDownloadException("IOException in writing to servlet response", e); } LOGGER.exiting(); } DownloadResponder(TransferContext transferContext); void respond(); @Override String toString();  }### Answer:
@Test(expectedExceptions = ArtifactDownloadException.class) public void testFailedToGetArtifact() throws Exception { HttpServletRequest httpServletRequest = mock(HttpServletRequest.class); HttpServletResponse httpServletResponse = mock(HttpServletResponse.class); DownloadRequestProcessor downloadProcessor = mock(DownloadRequestProcessor.class); TransferContext transferContext = new TransferContext(httpServletRequest, httpServletResponse); transferContext.setDownloadRequestProcessor(downloadProcessor); when(httpServletRequest.getPathInfo()).thenReturn("/userOne/DummyArtifact.any"); when(downloadProcessor.getArtifact(Mockito.anyString())).thenThrow(new ArtifactDownloadException("")); DownloadResponder downloadResponder = spy(new DownloadResponder(transferContext)); downloadResponder.respond(); }