- Fix missing import in groovy test.

- Code polishing.
This commit is contained in:
Lampros Smyrnaios 2023-07-14 14:26:11 +03:00
parent b63f09bfc4
commit 8b4da5c4eb
3 changed files with 9 additions and 13 deletions

View File

@ -32,13 +32,11 @@ public final class SyntheticGuideline extends AbstractGuideline<Document> {
String canonical = Helper.ensureNonEmpty(name, () -> new IllegalArgumentException("Name cannot be empty"));
// Here we define a guideline with a specific elementSpec as origin, we cannot allow null
if (elementSpec == null) {
if ( elementSpec == null )
throw new IllegalArgumentException("ElementSpec cannot be empty");
}
if (weight < 0) {
if ( weight < 0 )
throw new IllegalArgumentException("Weight cannot be negative");
}
SyntheticGuideline guideline = new SyntheticGuideline(canonical, weight);
guideline.compilationResult = new ElementSpecCompiler().compile(elementSpec, evaluation::get);
@ -49,17 +47,14 @@ public final class SyntheticGuideline extends AbstractGuideline<Document> {
public static SyntheticGuideline of(String name, int weight, RequirementLevel requirementLevel, Rule<Document> rule) {
String canonical = Helper.ensureNonEmpty(name, () -> new IllegalArgumentException("Name cannot be empty"));
if (weight < 0) {
if ( weight < 0 )
throw new IllegalArgumentException("Weight cannot be negative");
}
if (requirementLevel == null) {
if ( requirementLevel == null )
throw new IllegalArgumentException("Requirement level cannot be empty");
}
if (rule == null) {
if ( rule == null )
throw new IllegalArgumentException("Rule cannot be empty");
}
SyntheticGuideline guideline = new SyntheticGuideline(canonical, weight);
CompilationResult compilationResult = new CompilationResult();

View File

@ -1,5 +1,6 @@
package eu.dnetlib.validator2.engine
import eu.dnetlib.validator2.engine.Helper
import groovy.xml.DOMBuilder
import groovy.xml.FactorySupport
import org.w3c.dom.Document