private void assertGood(String spec) throws ParseException { HostSpecifier.fromValid(spec); // Throws exception if not working correctly HostSpecifier.from(spec); assertTrue(HostSpecifier.isValid(spec)); }
/** * Returns a {@link HostSpecifier} instance representing the specified {@link String} {@literal value}. * * @param value The configuration parameter's {@link String} value * @return An {@link HostSpecifier} instance representing the configuration parameter's value */ @Override public HostSpecifier convertFrom(String value) { final HostSpecifier result; try { result = HostSpecifier.from(value); } catch (Exception ex) { throw new ParameterException("Couldn't convert value \"" + value + "\" to HostSpecifier.", ex); } return result; }
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 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)); }