private void assertGood(String spec) throws ParseException { HostSpecifier.fromValid(spec); // Throws exception if not working correctly HostSpecifier.from(spec); assertTrue(HostSpecifier.isValid(spec)); }
private void assertBad(String spec) { try { HostSpecifier.fromValid(spec); fail("Should have thrown IllegalArgumentException: " + spec); } catch (IllegalArgumentException expected) { } try { HostSpecifier.from(spec); fail("Should have thrown ParseException: " + spec); } catch (ParseException expected) { assertThat(expected).hasCauseThat().isInstanceOf(IllegalArgumentException.class); } assertFalse(HostSpecifier.isValid(spec)); } }
private void assertGood(String spec) throws ParseException { HostSpecifier.fromValid(spec); // Throws exception if not working correctly HostSpecifier.from(spec); assertTrue(HostSpecifier.isValid(spec)); }
private void conditionallyCheckSSH() { if (vm.getPassword() != null && !loginCredentials.getOptionalPassword().isPresent()) loginCredentials = loginCredentials.toBuilder().password(vm.getPassword()).build(); assert HostSpecifier.isValid(vm.getIPAddress()); if (!InetAddresses2.isPrivateIPAddress(vm.getIPAddress())) { // not sure if the network is public or not, so we have to test HostAndPort socket = HostAndPort.fromParts(vm.getIPAddress(), 22); System.err.printf("testing socket %s%n", socket); System.err.printf("testing ssh %s%n", socket); checkSSH(socket); } else { System.err.printf("skipping ssh %s, as private%n", vm.getIPAddress()); } }
private void conditionallyCheckSSH() { if (vm.getPassword() != null && loginCredentials.getOptionalPassword() == null) loginCredentials = loginCredentials.toBuilder().password(vm.getPassword()).build(); assert HostSpecifier.isValid(vm.getIPAddress()); if (!InetAddresses2.isPrivateIPAddress(vm.getIPAddress())) { // not sure if the network is public or not, so we have to test HostAndPort socket = HostAndPort.fromParts(vm.getIPAddress(), 22); System.err.printf("testing socket %s%n", socket); System.err.printf("testing ssh %s%n", socket); checkSSH(socket); } else { System.err.printf("skipping ssh %s, as private%n", vm.getIPAddress()); } }
private void assertBad(String spec) { try { HostSpecifier.fromValid(spec); fail("Should have thrown IllegalArgumentException: " + spec); } catch (IllegalArgumentException expected) { } try { HostSpecifier.from(spec); fail("Should have thrown ParseException: " + spec); } catch (ParseException expected) { assertThat(expected.getCause()).isInstanceOf(IllegalArgumentException.class); } assertFalse(HostSpecifier.isValid(spec)); }