HostName { public String determineHostName() { String hostname = getHostNameFromEnv(); if (isEmpty(hostname)) { hostname = execHostName(); } assert !isEmpty(hostname); return hostname; }  String determineHostName();  }
@Test @Parameters({MAC_OSX_NAME, LINUX_OS_NAME, SOLARIS_OS_NAME, WINDOWS_OS_NAME}) public void shouldExecHostNameIfEnvValueNotAvailableOnOS(String osName) throws IOException { setHostNamePropertiesNull(osName); String result = new HostName().determineHostName(); assertThat(result).isNotNull(); }
@Test @Parameters({MAC_OSX_NAME, LINUX_OS_NAME, SOLARIS_OS_NAME, WINDOWS_OS_NAME}) public void shouldUseComputerNameIfAvailableOnOS(String osName) throws IOException { setHostNameProperties(osName); String result = new HostName().determineHostName(); assertThat(result).isEqualTo(EXPECTED_HOSTNAME); }