### Question:
DockerUtil { public boolean areMicroserviceAndContainerEqual(String containerId, Microservice microservice) { LoggingService.logDebug(MODULE_NAME ,"Are Microservice And Container Equal"); InspectContainerResponse inspectInfo = dockerClient.inspectContainerCmd(containerId).exec(); return isPortMappingEqual(inspectInfo, microservice) && isNetworkModeEqual(inspectInfo, microservice); } 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 testAreMicroserviceAndContainerEqualWhenContainerAndMicorserivceAreNotEqual() { try { assertFalse(dockerUtil.areMicroserviceAndContainerEqual(containerID, microservice)); PowerMockito.verifyPrivate(dockerUtil).invoke("isPortMappingEqual", any(), any()); PowerMockito.verifyPrivate(dockerUtil).invoke("isNetworkModeEqual", any(), any()); } catch (Exception e) { fail("This should not happen"); } }
@Test public void testAreMicroserviceAndContainerEqualWhenContainerAndMicorserivceAreEqual() { try { PowerMockito.when(inspectContainerResponse.getHostConfig()).thenReturn(hostConfig); PowerMockito.when(hostConfig.getExtraHosts()).thenReturn(extraHost); PowerMockito.when(hostConfig.getNetworkMode()).thenReturn("host"); PowerMockito.when(microservice.isRootHostAccess()).thenReturn(true); assertTrue(dockerUtil.areMicroserviceAndContainerEqual(containerID, microservice)); PowerMockito.verifyPrivate(dockerUtil).invoke("isPortMappingEqual", any(), any()); PowerMockito.verifyPrivate(dockerUtil).invoke("isNetworkModeEqual", any(), any()); PowerMockito.verifyPrivate(dockerUtil).invoke("getMicroservicePorts", any()); PowerMockito.verifyPrivate(dockerUtil).invoke("getContainerPorts", any()); } catch (Exception e) { fail("This should not happen"); } }