@Test public void ensureValidIndexNameTest() { String[] validIndexNames = new String[]{ "a", "ab", "ab1", "b-c", "d_e", "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" }; for (String name : validIndexNames) { Validator.ensureValidIndexName(name); } }
public static void ensureValidIndexName(String indexName) { if (!validIndexName(indexName)) { throw new ValidationException(String.format("Invalid index name: %s", indexName)); } }
Validator { public static void ensureValidIndexName(String indexName) { if (!validIndexName(indexName)) { throw new ValidationException(String.format("Invalid index name: %s", indexName)); } } }
Validator { public static void ensureValidIndexName(String indexName) { if (!validIndexName(indexName)) { throw new ValidationException(String.format("Invalid index name: %s", indexName)); } } Validator(); }
Validator { public static void ensureValidIndexName(String indexName) { if (!validIndexName(indexName)) { throw new ValidationException(String.format("Invalid index name: %s", indexName)); } } Validator(); @SuppressWarnings("WeakerAccess") static boolean validIndexName(String indexName); static void ensureValidIndexName(String indexName); @SuppressWarnings("WeakerAccess") static boolean validFieldName(String fieldName); static void ensureValidFieldName(String fieldName); @SuppressWarnings("WeakerAccess") static boolean validLabel(String label); static void ensureValidLabel(String label); @SuppressWarnings("WeakerAccess") static boolean validKey(String key); static void ensureValidKey(String key); }
Validator { public static void ensureValidIndexName(String indexName) { if (!validIndexName(indexName)) { throw new ValidationException(String.format("Invalid index name: %s", indexName)); } } Validator(); @SuppressWarnings("WeakerAccess") static boolean validIndexName(String indexName); static void ensureValidIndexName(String indexName); @SuppressWarnings("WeakerAccess") static boolean validFieldName(String fieldName); static void ensureValidFieldName(String fieldName); @SuppressWarnings("WeakerAccess") static boolean validLabel(String label); static void ensureValidLabel(String label); @SuppressWarnings("WeakerAccess") static boolean validKey(String key); static void ensureValidKey(String key);  }