@Test public void testGetUpdateInfoShouldReturnErrorResponse() throws Exception { doReturn(artifact).when(service).createArtifact(artifact.getName()); doReturn(InstallType.SINGLE_SERVER).when(configManager).detectInstallationType(); doThrow(new IOException("error")) .when(mockFacade) .getUpdateInfo(artifact, InstallType.SINGLE_SERVER); Response response = service.getUpdateInfo(); assertEquals(response.getStatus(), Response.Status.INTERNAL_SERVER_ERROR.getStatusCode()); }
@Test public void testGetUpdateInfoShouldReturnOkResponse() throws Exception { doReturn(artifact).when(service).createArtifact(artifact.getName()); doReturn(InstallType.SINGLE_SERVER).when(configManager).detectInstallationType(); doReturn(ImmutableList.of("a", "b")) .when(mockFacade) .getInstallInfo(artifact, InstallType.SINGLE_SERVER); Response response = service.getUpdateInfo(); assertEquals(response.getStatus(), Response.Status.OK.getStatusCode()); }