DockerBootstrap implements Bootstrap { public GenericContainer getContainer() { return container; } DockerBootstrap();  DockerBootstrap(URL url); @Override ComponentMetadata getMetadata(); @Override String getProperties(); @Override void loadConfig(Map<String, String> configs); @Override Bootstrap start(); @Override Bootstrap stop(); GenericContainer getContainer();  }
@Test public void testContainerShouldStart() throws NotFoundServiceException, IOException { DockerBootstrap testcontainer = (DockerBootstrap) HadoopBootstrap.INSTANCE.getService("DOCKER"); String containerIpAddress = testcontainer.getContainer().getContainerIpAddress(); Integer firstMappedPort = testcontainer.getContainer().getFirstMappedPort(); Socket pingSocket = new Socket("localhost", firstMappedPort); PrintWriter out = new PrintWriter(pingSocket.getOutputStream(), true); BufferedReader in = new BufferedReader(new InputStreamReader(pingSocket.getInputStream())); out.println("ping"); String response = in.readLine(); out.close(); in.close(); pingSocket.close(); assertThat(response).isEqualTo("42"); assertThat(containerIpAddress).isEqualTo("localhost"); assertThat(firstMappedPort).isEqualTo(21300); }