From 8595f55eb3712471241b2c72df29964d0b29969d Mon Sep 17 00:00:00 2001 From: Hans Aikema Date: Sun, 17 Sep 2017 15:53:38 +0200 Subject: [PATCH] Put Fields first in class as requested by codacy/pr automated review --- .../xml/hints/EvidenceMatcher.java | 34 +++++++++---------- .../xml/hints/EvidenceMatcherTest.java | 14 ++++---- 2 files changed, 24 insertions(+), 24 deletions(-) diff --git a/dependency-check-core/src/main/java/org/owasp/dependencycheck/xml/hints/EvidenceMatcher.java b/dependency-check-core/src/main/java/org/owasp/dependencycheck/xml/hints/EvidenceMatcher.java index c7dcafd68..8ab95f802 100644 --- a/dependency-check-core/src/main/java/org/owasp/dependencycheck/xml/hints/EvidenceMatcher.java +++ b/dependency-check-core/src/main/java/org/owasp/dependencycheck/xml/hints/EvidenceMatcher.java @@ -35,23 +35,6 @@ import org.owasp.dependencycheck.dependency.Evidence; */ public class EvidenceMatcher { - /** - * Creates a new EvidenceMatcher objects. - * - * @param source the source of the evidence, a source that is {@code null} indicates any source should match. - * @param name the non-{@code null} name of the evidence. - * @param value the non-{@code null} value of the evidence. - * @param regex whether value is a regex. - * @param confidence the confidence of the evidence, a confidence that is {@code null} indicates any confidence should match. - */ - public EvidenceMatcher(String source, String name, String value, boolean regex, Confidence confidence) { - this.source = source; - this.name = name; - this.value = value; - this.confidence = confidence; - this.regex = regex; - } - /** * The name that the {@link Evidence} should have for a match. */ @@ -81,6 +64,23 @@ public class EvidenceMatcher { */ private Confidence confidence; + /** + * Creates a new EvidenceMatcher objects. + * + * @param source the source of the evidence, a source that is {@code null} indicates any source should match. + * @param name the non-{@code null} name of the evidence. + * @param value the non-{@code null} value of the evidence. + * @param regex whether value is a regex. + * @param confidence the confidence of the evidence, a confidence that is {@code null} indicates any confidence should match. + */ + public EvidenceMatcher(String source, String name, String value, boolean regex, Confidence confidence) { + this.source = source; + this.name = name; + this.value = value; + this.confidence = confidence; + this.regex = regex; + } + /** * Tests whether the given Evidence matches this EvidenceMatcher. * @param evidence diff --git a/dependency-check-core/src/test/java/org/owasp/dependencycheck/xml/hints/EvidenceMatcherTest.java b/dependency-check-core/src/test/java/org/owasp/dependencycheck/xml/hints/EvidenceMatcherTest.java index f45f7337e..f550d8d82 100644 --- a/dependency-check-core/src/test/java/org/owasp/dependencycheck/xml/hints/EvidenceMatcherTest.java +++ b/dependency-check-core/src/test/java/org/owasp/dependencycheck/xml/hints/EvidenceMatcherTest.java @@ -34,6 +34,13 @@ public class EvidenceMatcherTest { private static final Evidence EVIDENCE_MEDIUM_SECOND_SOURCE = new Evidence("source 2", "name", "value", Confidence.MEDIUM); private static final Evidence EVIDENCE_LOW = new Evidence("source", "name", "value", Confidence.LOW); + private static final Evidence REGEX_EVIDENCE_HIGHEST = new Evidence("source", "name", "value 1", Confidence.HIGHEST); + private static final Evidence REGEX_EVIDENCE_HIGH = new Evidence("source", "name", "value 2", Confidence.HIGH); + private static final Evidence REGEX_EVIDENCE_MEDIUM = new Evidence("source", "name", "Value will not match because of case", Confidence.MEDIUM); + private static final Evidence REGEX_EVIDENCE_MEDIUM_SECOND_SOURCE = new Evidence("source 2", "name", "yet another value that will match", Confidence.MEDIUM); + private static final Evidence REGEX_EVIDENCE_MEDIUM_THIRD_SOURCE = new Evidence("source 3", "name", "and even more values to match", Confidence.MEDIUM); + private static final Evidence REGEX_EVIDENCE_LOW = new Evidence("source", "name", "val that should not match", Confidence.LOW); + @Test public void testExactMatching() throws Exception { final EvidenceMatcher exactMatcherHighest = new EvidenceMatcher("source", "name", "value", false, Confidence.HIGHEST); @@ -64,13 +71,6 @@ public class EvidenceMatcherTest { assertFalse("wildcard source matcher should not match EVIDENCE_LOW", wildcardSourceMatcher.matches(EVIDENCE_LOW)); } - private static final Evidence REGEX_EVIDENCE_HIGHEST = new Evidence("source", "name", "value 1", Confidence.HIGHEST); - private static final Evidence REGEX_EVIDENCE_HIGH = new Evidence("source", "name", "value 2", Confidence.HIGH); - private static final Evidence REGEX_EVIDENCE_MEDIUM = new Evidence("source", "name", "Value will not match because of case", Confidence.MEDIUM); - private static final Evidence REGEX_EVIDENCE_MEDIUM_SECOND_SOURCE = new Evidence("source 2", "name", "yet another value that will match", Confidence.MEDIUM); - private static final Evidence REGEX_EVIDENCE_MEDIUM_THIRD_SOURCE = new Evidence("source 3", "name", "and even more values to match", Confidence.MEDIUM); - private static final Evidence REGEX_EVIDENCE_LOW = new Evidence("source", "name", "val that should not match", Confidence.LOW); - @Test public void testRegExMatching() throws Exception { final EvidenceMatcher regexMediumMatcher = new EvidenceMatcher("source 2", "name", ".*value.*", true, Confidence.MEDIUM);