### Question:
DockerUtil { @SuppressWarnings("deprecation") public String getContainerIpAddress(String id) throws AgentSystemException { LoggingService.logDebug(MODULE_NAME , "get Container IpAddress"); try { InspectContainerResponse inspect = dockerClient.inspectContainerCmd(id).exec(); LoggingService.logDebug(MODULE_NAME , "Finished get Container IpAddress"); return inspect.getNetworkSettings().getIpAddress(); } catch (NotModifiedException exp) { logError(MODULE_NAME, "Error getting container ipAddress", new AgentSystemException(exp.getMessage(), exp)); throw new AgentSystemException(exp.getMessage(), exp); }catch (NotFoundException exp) { logError(MODULE_NAME, "Error getting container ipAddress", new AgentSystemException(exp.getMessage(), exp)); throw new AgentSystemException(exp.getMessage(), exp); }catch (Exception exp) { logError(MODULE_NAME, "Error getting container ipAddress", new AgentSystemException(exp.getMessage(), exp)); throw new AgentSystemException(exp.getMessage(), exp); } } private  DockerUtil(); static DockerUtil getInstance(); void reInitDockerClient(); String getDockerBridgeName(); void startContainer(Microservice microservice); void stopContainer(String id); void removeContainer(String id, Boolean withRemoveVolumes); @SuppressWarnings("deprecation") String getContainerIpAddress(String id); String getContainerName(Container container); String getContainerMicroserviceUuid(Container container); static String getIoFogContainerName(String microserviceUuid); Optional<Container> getContainer(String microserviceUuid); MicroserviceStatus getMicroserviceStatus(String containerId); List<Container> getRunningContainers(); List<Container> getRunningIofogContainers(); Optional<Statistics> getContainerStats(String containerId); long getContainerStartedAt(String id); boolean areMicroserviceAndContainerEqual(String containerId, Microservice microservice); Optional<String> getContainerStatus(String containerId); boolean isContainerRunning(String containerId); List<Container> getContainers(); void removeImageById(String imageId); @SuppressWarnings("resource") void pullImage(String imageName, String microserviceUuid, Registry registry); boolean findLocalImage(String imageName); String createContainer(Microservice microservice, String host); PruneResponse dockerPrune(); void update(PullResponseItem item, Map<String, ItemStatus> statuses);  }### Answer:
@Test public void testGetContainerIpAddress() { try { assertEquals(ipAddress, dockerUtil.getContainerIpAddress(containerID)); } catch (Exception e) { fail("This should not happen"); } }
@Test (expected = AgentSystemException.class) public void throwsNotFoundExceptionExceptionGetContainerIpAddress() throws AgentSystemException { PowerMockito.doThrow(spy(new NotFoundException("Exception"))).when(inspectContainerCmd).exec(); assertEquals(ipAddress, dockerUtil.getContainerIpAddress(containerID)); }
@Test (expected = AgentSystemException.class) public void throwsNotModifiedExceptionGetContainerIpAddress() throws AgentSystemException { PowerMockito.doThrow(spy(new NotModifiedException("Exception"))).when(inspectContainerCmd).exec(); assertEquals(ipAddress, dockerUtil.getContainerIpAddress(containerID)); }