@Test public void testValidateIpInvalid() { InputValidationNotes notes = validateIp("1.1.1.1111"); assertThat( notes, equalTo( new InputValidationNotes( Validity.INVALID, "Invalid IPv4 address: 1.1.1.1111. 1111 is an invalid octet"))); }
@VisibleForTesting static InputValidationNotes validateIp(String query) { try { Ip ip = Ip.parse(query); return new InputValidationNotes(Validity.VALID, ip.toString()); } catch (Exception e) { return new InputValidationNotes(Validity.INVALID, e.getMessage()); } }
InputValidationUtils { @VisibleForTesting static InputValidationNotes validateIp(String query) { try { Ip ip = Ip.parse(query); return new InputValidationNotes(Validity.VALID, ip.toString()); } catch (Exception e) { return new InputValidationNotes(Validity.INVALID, e.getMessage()); } } }
InputValidationUtils { @VisibleForTesting static InputValidationNotes validateIp(String query) { try { Ip ip = Ip.parse(query); return new InputValidationNotes(Validity.VALID, ip.toString()); } catch (Exception e) { return new InputValidationNotes(Validity.INVALID, e.getMessage()); } }  }
InputValidationUtils { @VisibleForTesting static InputValidationNotes validateIp(String query) { try { Ip ip = Ip.parse(query); return new InputValidationNotes(Validity.VALID, ip.toString()); } catch (Exception e) { return new InputValidationNotes(Validity.INVALID, e.getMessage()); } }  @Nonnull static InputValidationNotes validate(
      Variable.Type varType,
      String query,
      CompletionMetadata completionMetadata,
      NodeRolesData nodeRolesData,
      ReferenceLibrary referenceLibrary); static String getErrorMessage(String grammarName, int startIndex); static String getErrorMessage(IllegalArgumentException exception); static String getErrorMessageEmptyNameRegex(String nameRegex, String nameType); static String getErrorMessageMissingName(String name, String nameType); static String getErrorMessageMissingGroup(
      String group, String groupType, String book, String bookType); static String getErrorMessageMissingBook(String book, String bookType); }
InputValidationUtils { @VisibleForTesting static InputValidationNotes validateIp(String query) { try { Ip ip = Ip.parse(query); return new InputValidationNotes(Validity.VALID, ip.toString()); } catch (Exception e) { return new InputValidationNotes(Validity.INVALID, e.getMessage()); } }  @Nonnull static InputValidationNotes validate(
      Variable.Type varType,
      String query,
      CompletionMetadata completionMetadata,
      NodeRolesData nodeRolesData,
      ReferenceLibrary referenceLibrary); static String getErrorMessage(String grammarName, int startIndex); static String getErrorMessage(IllegalArgumentException exception); static String getErrorMessageEmptyNameRegex(String nameRegex, String nameType); static String getErrorMessageMissingName(String name, String nameType); static String getErrorMessageMissingGroup(
      String group, String groupType, String book, String bookType); static String getErrorMessageMissingBook(String book, String bookType);  }