@Test public void testInvalidRoot() { assertThatExceptionOfType(IllegalArgumentException.class) .isThrownBy(() -> ConnectionResource.fromName("foo")); }
public static ConnectionResource fromName(String name) { String[] parts = StringUtils.split(name, '/'); if (!parts[0].equals(ROOT_NAME) || parts.length > 1) { throw new IllegalArgumentException(String.format("%s is not a valid connection resource name", name)); } return root(); }
ConnectionResource implements IResource, Comparable<ConnectionResource> { public static ConnectionResource fromName(String name) { String[] parts = StringUtils.split(name, '/'); if (!parts[0].equals(ROOT_NAME) || parts.length > 1) { throw new IllegalArgumentException(String.format("%s is not a valid connection resource name", name)); } return root(); } }
ConnectionResource implements IResource, Comparable<ConnectionResource> { public static ConnectionResource fromName(String name) { String[] parts = StringUtils.split(name, '/'); if (!parts[0].equals(ROOT_NAME) || parts.length > 1) { throw new IllegalArgumentException(String.format("%s is not a valid connection resource name", name)); } return root(); } private  ConnectionResource(); }
ConnectionResource implements IResource, Comparable<ConnectionResource> { public static ConnectionResource fromName(String name) { String[] parts = StringUtils.split(name, '/'); if (!parts[0].equals(ROOT_NAME) || parts.length > 1) { throw new IllegalArgumentException(String.format("%s is not a valid connection resource name", name)); } return root(); } private  ConnectionResource(); static ConnectionResource root(); static ConnectionResource fromName(String name); @Override String getName(); @Override IResource getParent(); @Override boolean hasParent(); @Override boolean exists(); @Override Set<Permission> applicablePermissions(); @Override int compareTo(@NotNull ConnectionResource o); @Override String toString(); @Override boolean equals(Object o); @Override int hashCode(); }
ConnectionResource implements IResource, Comparable<ConnectionResource> { public static ConnectionResource fromName(String name) { String[] parts = StringUtils.split(name, '/'); if (!parts[0].equals(ROOT_NAME) || parts.length > 1) { throw new IllegalArgumentException(String.format("%s is not a valid connection resource name", name)); } return root(); } private  ConnectionResource(); static ConnectionResource root(); static ConnectionResource fromName(String name); @Override String getName(); @Override IResource getParent(); @Override boolean hasParent(); @Override boolean exists(); @Override Set<Permission> applicablePermissions(); @Override int compareTo(@NotNull ConnectionResource o); @Override String toString(); @Override boolean equals(Object o); @Override int hashCode();  }