@Test public void invalidPathNameWithHyphenLast() { assertThat(CloudnamePath.isValidPathElementName("invalid-"), is(false)); }
public static boolean isValidPathElementName(final String name) { if (name == null || name.isEmpty()) { return false; } final Matcher matcher = NAME_PATTERN.matcher(name); if (!matcher.matches()) { return false; } if (name.length() > 64) { return false; } if (name.charAt(0) == '-' || name.charAt(name.length() - 1) == '-') { return false; } return true; }
CloudnamePath { public static boolean isValidPathElementName(final String name) { if (name == null || name.isEmpty()) { return false; } final Matcher matcher = NAME_PATTERN.matcher(name); if (!matcher.matches()) { return false; } if (name.length() > 64) { return false; } if (name.charAt(0) == '-' || name.charAt(name.length() - 1) == '-') { return false; } return true; } }
CloudnamePath { public static boolean isValidPathElementName(final String name) { if (name == null || name.isEmpty()) { return false; } final Matcher matcher = NAME_PATTERN.matcher(name); if (!matcher.matches()) { return false; } if (name.length() > 64) { return false; } if (name.charAt(0) == '-' || name.charAt(name.length() - 1) == '-') { return false; } return true; } CloudnamePath(final String[] pathElements);  CloudnamePath(final CloudnamePath path, final String additionalElement); }
CloudnamePath { public static boolean isValidPathElementName(final String name) { if (name == null || name.isEmpty()) { return false; } final Matcher matcher = NAME_PATTERN.matcher(name); if (!matcher.matches()) { return false; } if (name.length() > 64) { return false; } if (name.charAt(0) == '-' || name.charAt(name.length() - 1) == '-') { return false; } return true; } CloudnamePath(final String[] pathElements);  CloudnamePath(final CloudnamePath path, final String additionalElement); static boolean isValidPathElementName(final String name); int length(); String join(final char separator); String get(final int index); boolean isSubpathOf(final CloudnamePath other); CloudnamePath getParent(); @Override boolean equals(final Object other); @Override int hashCode(); @Override String toString(); }
CloudnamePath { public static boolean isValidPathElementName(final String name) { if (name == null || name.isEmpty()) { return false; } final Matcher matcher = NAME_PATTERN.matcher(name); if (!matcher.matches()) { return false; } if (name.length() > 64) { return false; } if (name.charAt(0) == '-' || name.charAt(name.length() - 1) == '-') { return false; } return true; } CloudnamePath(final String[] pathElements);  CloudnamePath(final CloudnamePath path, final String additionalElement); static boolean isValidPathElementName(final String name); int length(); String join(final char separator); String get(final int index); boolean isSubpathOf(final CloudnamePath other); CloudnamePath getParent(); @Override boolean equals(final Object other); @Override int hashCode(); @Override String toString();  }