NetworkUtils { public static String getDockerMachineName(Map<String, String> environment) { String envVar = DOCKER_MACHINE_NAME; String dockerMachineName = environment.getOrDefault(envVar, ""); if (dockerMachineName == null || dockerMachineName.isEmpty()) { LOG.debug("The environmental variable DOCKER_MACHINE_NAME was not found. Using docker0 address."); } return dockerMachineName; }  static InetAddress hostAddress(); static InetSocketAddress hostSocket(int port); static String addressToString(InetSocketAddress address, Boolean useIpAddress); static String getDockerMachineName(Map<String, String> environment); static String getDockerHostIpAddress(Map<String, String> environment); static Map<String, String> getEnvironment(); static String runCommand(CommandLine commandline); static String getDocker0AdapterIPAddress(); static final String DOCKER_MACHINE_IP; static final String LOCALHOST; static final String DOCKER_MACHINE_NAME; }
@Test public void shouldReturnDockerMachineNameWhenIncluded() { HashMap<String, String> map = new HashMap<>(); String dev = "dev"; map.put(NetworkUtils.DOCKER_MACHINE_NAME, dev); assertEquals(dev, NetworkUtils.getDockerMachineName(map)); }