private void assertHasNoChildProjects()

in src/main/java/com/googlesource/gerrit/plugins/deleteproject/DeletePreconditions.java [136:149]


  private void assertHasNoChildProjects(ProjectResource rsrc) throws CannotDeleteProjectException {
    List<ProjectInfo> children;
    try {
      children = listChildProjectsProvider.get().withLimit(1).apply(rsrc).value();
    } catch (Exception e) {
      throw new CannotDeleteProjectException(
          String.format("Unable to verify if '%s' has children projects.", rsrc.getName()), e);
    }
    if (!children.isEmpty()) {
      throw new CannotDeleteProjectException(
          "Cannot delete project because it has at least one child: "
              + Iterables.getOnlyElement(children).name);
    }
  }