diff --git a/src/main/java/eu/dnetlib/validator2/validation/guideline/SyntheticGuideline.java b/src/main/java/eu/dnetlib/validator2/validation/guideline/SyntheticGuideline.java index a00716a..9faecb1 100644 --- a/src/main/java/eu/dnetlib/validator2/validation/guideline/SyntheticGuideline.java +++ b/src/main/java/eu/dnetlib/validator2/validation/guideline/SyntheticGuideline.java @@ -32,13 +32,11 @@ public final class SyntheticGuideline extends AbstractGuideline { 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 { public static SyntheticGuideline of(String name, int weight, RequirementLevel requirementLevel, Rule 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(); diff --git a/src/main/java/eu/dnetlib/validator2/validation/guideline/openaire/AbstractOpenAireProfile.java b/src/main/java/eu/dnetlib/validator2/validation/guideline/openaire/AbstractOpenAireProfile.java index 88e6bf4..4f97071 100644 --- a/src/main/java/eu/dnetlib/validator2/validation/guideline/openaire/AbstractOpenAireProfile.java +++ b/src/main/java/eu/dnetlib/validator2/validation/guideline/openaire/AbstractOpenAireProfile.java @@ -42,7 +42,7 @@ public abstract class AbstractOpenAireProfile implements XMLApplicationProfile { final Map results = new HashMap<>(); // Validate the document against all guideline-elements. - for (Guideline guidelineElement : guidelines()) + for ( Guideline guidelineElement : guidelines() ) { String guidelineElementName = guidelineElement.getName(); if ( logger.isTraceEnabled() ) @@ -79,10 +79,10 @@ public abstract class AbstractOpenAireProfile implements XMLApplicationProfile { // The nodes contain all the elementName nodes int len = nodes.getLength(); if (len == 0) { return false; } // element is not present - for(int i = 0; i < len; i++) { + for ( int i = 0; i < len; i++ ) { Node elem = nodes.item(i); String value = Helper.getAttributeValue(elem, attrName); - if (!attrValue.equals(value)) { return false; } + if ( !attrValue.equals(value) ) { return false; } } return true; }); diff --git a/src/test/groovy/eu/dnetlib/validator2/engine/XMLHelper.groovy b/src/test/groovy/eu/dnetlib/validator2/engine/XMLHelper.groovy index aea8094..1eb1eb0 100644 --- a/src/test/groovy/eu/dnetlib/validator2/engine/XMLHelper.groovy +++ b/src/test/groovy/eu/dnetlib/validator2/engine/XMLHelper.groovy @@ -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