### Question:
DownloadRequestProcessor { public ManagedArtifact getArtifact(String pathInfo) { LOGGER.entering(); ManagedArtifact managedArtifact = serverRepository.getArtifact(pathInfo); LOGGER.exiting(managedArtifact); return managedArtifact; } DownloadRequestProcessor(); ManagedArtifact getArtifact(String pathInfo);  }### Answer:
@Test(expectedExceptions = ArtifactDownloadException.class) public void testFailedGetArtifact() { ServerRepository serverRepository = mock(ServerRepository.class); when(serverRepository.getArtifact(Mockito.anyString())).thenThrow(new ArtifactDownloadException("")); DownloadRequestProcessor downloadRequestProcessor = new DownloadRequestProcessor(); Whitebox.setInternalState(downloadRequestProcessor, "serverRepository", serverRepository); downloadRequestProcessor.getArtifact("/userOne/DummyArtifact.any"); }
@Test() public void testGetArtifact() { ServerRepository serverRepository = mock(ServerRepository.class); ManagedArtifact managedArtifact = mock(ManagedArtifact.class); when(serverRepository.getArtifact(Mockito.anyString())).thenReturn(managedArtifact); DownloadRequestProcessor downloadRequestProcessor = new DownloadRequestProcessor(); Whitebox.setInternalState(downloadRequestProcessor, "serverRepository", serverRepository); downloadRequestProcessor.getArtifact("/userOne/DummyArtifact.any"); }