@Test public void areDependenciesAllowed() { try { AllowedDependencyValidator.areDependenciesAllowed(asList(artifactCoordinates)); } catch (ValidationException e) { if (isAllowed) { fail("The artifact " + artifactCoordinates.toString() + " should not pass the validation"); } return; } if (!isAllowed) { fail("The artifact " + artifactCoordinates.toString() + " should not pass the validation"); } }
public static Boolean areDependenciesAllowed(List<ArtifactCoordinates> artifactCoordinates) throws ValidationException { List<ArtifactCoordinates> notAllowedDependencies = collectNotAllowedDependencies(artifactCoordinates); if (!notAllowedDependencies.isEmpty()) { StringBuilder notAllowedMessage = new StringBuilder(); notAllowedDependencies.forEach(d -> notAllowedMessage.append(d.toString()).append(",")); throw new ValidationException("The following dependencies are not allowed unless their scope is [provided]: " + removeEnd(notAllowedMessage.toString(), ",")); } return true; }
AllowedDependencyValidator { public static Boolean areDependenciesAllowed(List<ArtifactCoordinates> artifactCoordinates) throws ValidationException { List<ArtifactCoordinates> notAllowedDependencies = collectNotAllowedDependencies(artifactCoordinates); if (!notAllowedDependencies.isEmpty()) { StringBuilder notAllowedMessage = new StringBuilder(); notAllowedDependencies.forEach(d -> notAllowedMessage.append(d.toString()).append(",")); throw new ValidationException("The following dependencies are not allowed unless their scope is [provided]: " + removeEnd(notAllowedMessage.toString(), ",")); } return true; } }
AllowedDependencyValidator { public static Boolean areDependenciesAllowed(List<ArtifactCoordinates> artifactCoordinates) throws ValidationException { List<ArtifactCoordinates> notAllowedDependencies = collectNotAllowedDependencies(artifactCoordinates); if (!notAllowedDependencies.isEmpty()) { StringBuilder notAllowedMessage = new StringBuilder(); notAllowedDependencies.forEach(d -> notAllowedMessage.append(d.toString()).append(",")); throw new ValidationException("The following dependencies are not allowed unless their scope is [provided]: " + removeEnd(notAllowedMessage.toString(), ",")); } return true; }  }
AllowedDependencyValidator { public static Boolean areDependenciesAllowed(List<ArtifactCoordinates> artifactCoordinates) throws ValidationException { List<ArtifactCoordinates> notAllowedDependencies = collectNotAllowedDependencies(artifactCoordinates); if (!notAllowedDependencies.isEmpty()) { StringBuilder notAllowedMessage = new StringBuilder(); notAllowedDependencies.forEach(d -> notAllowedMessage.append(d.toString()).append(",")); throw new ValidationException("The following dependencies are not allowed unless their scope is [provided]: " + removeEnd(notAllowedMessage.toString(), ",")); } return true; }  static Boolean areDependenciesAllowed(List<ArtifactCoordinates> artifactCoordinates); static Boolean isDependencyAllowed(ArtifactCoordinates artifactCoordinates); }
AllowedDependencyValidator { public static Boolean areDependenciesAllowed(List<ArtifactCoordinates> artifactCoordinates) throws ValidationException { List<ArtifactCoordinates> notAllowedDependencies = collectNotAllowedDependencies(artifactCoordinates); if (!notAllowedDependencies.isEmpty()) { StringBuilder notAllowedMessage = new StringBuilder(); notAllowedDependencies.forEach(d -> notAllowedMessage.append(d.toString()).append(",")); throw new ValidationException("The following dependencies are not allowed unless their scope is [provided]: " + removeEnd(notAllowedMessage.toString(), ",")); } return true; }  static Boolean areDependenciesAllowed(List<ArtifactCoordinates> artifactCoordinates); static Boolean isDependencyAllowed(ArtifactCoordinates artifactCoordinates);  }