createIssue(final Matcher matcher, final LookaheadStre
}
String category = matcher.group(9);
- if ("Expected".equals(category)) {
+ if (EXPECTED_CATEGORY.equals(category)) {
return Optional.empty();
}
return builder.setLineStart(matcher.group(5))
@@ -124,7 +126,7 @@ else if (StringUtils.isNotBlank(matcher.group(7))) {
if (canResolveRelativeFileName(fileName, projectDir)) {
fileName = FilenameUtils.concat(projectDir, fileName);
}
- if ("MSBUILD".equals(fileName.trim())) {
+ if (MSBUILD.equals(fileName.trim())) {
fileName = "-";
}
return fileName;
@@ -132,7 +134,7 @@ else if (StringUtils.isNotBlank(matcher.group(7))) {
private boolean canResolveRelativeFileName(final String fileName, final String projectDir) {
return StringUtils.isNotBlank(projectDir) && FilenameUtils.getPrefixLength(fileName) == 0
- && !"MSBUILD".equals(fileName.trim());
+ && !MSBUILD.equals(fileName.trim());
}
}
diff --git a/src/main/java/edu/hm/hafner/analysis/parser/QtTranslationParser.java b/src/main/java/edu/hm/hafner/analysis/parser/QtTranslationParser.java
index c82923f98..c3341f5c0 100644
--- a/src/main/java/edu/hm/hafner/analysis/parser/QtTranslationParser.java
+++ b/src/main/java/edu/hm/hafner/analysis/parser/QtTranslationParser.java
@@ -196,7 +196,7 @@ public void endElement(final String uri, final String localName, final String qN
sourceValue = "";
}
- @Override
+ @Override @SuppressWarnings("PMD.UnusedAssignment") // false positive in PMD 7.0.0
public void characters(final char[] ch, final int start, final int length) {
lastColumnNumber = documentLocator.getColumnNumber();
if (CONTEXT_NAME.equals(elementTypeStack.getFirst())) {
diff --git a/src/main/java/edu/hm/hafner/analysis/parser/RevApiParser.java b/src/main/java/edu/hm/hafner/analysis/parser/RevApiParser.java
index f76edf247..f58e3e4f4 100644
--- a/src/main/java/edu/hm/hafner/analysis/parser/RevApiParser.java
+++ b/src/main/java/edu/hm/hafner/analysis/parser/RevApiParser.java
@@ -14,12 +14,14 @@
import edu.hm.hafner.analysis.Report;
import edu.hm.hafner.analysis.RevApiInfoExtension;
import edu.hm.hafner.analysis.Severity;
+import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
/**
* Parser for Revapi reports.
*/
public class RevApiParser extends JsonIssueParser {
private static final long serialVersionUID = -2452699725595063377L;
+ private static final int CAPACITY = 1024;
@Override
protected void parseJsonArray(final Report report, final JSONArray jsonReport, final IssueBuilder issueBuilder) {
@@ -101,8 +103,9 @@ private Severity toSeverity(final String level) {
}
}
+ @SuppressFBWarnings(value = "POTENTIAL_XML_INJECTION", justification = "Message is cleaned in UI")
private String getDescription(final JSONObject jsonIssue) {
- StringBuilder severityDescription = new StringBuilder();
+ StringBuilder severityDescription = new StringBuilder(CAPACITY);
for (Object severity : jsonIssue.getJSONArray("classification")) {
if (severity instanceof JSONObject) {
severityDescription.append("Compatibility: ")
diff --git a/src/main/java/edu/hm/hafner/analysis/parser/RfLintParser.java b/src/main/java/edu/hm/hafner/analysis/parser/RfLintParser.java
index 9be1e2267..d83bc0091 100644
--- a/src/main/java/edu/hm/hafner/analysis/parser/RfLintParser.java
+++ b/src/main/java/edu/hm/hafner/analysis/parser/RfLintParser.java
@@ -165,6 +165,7 @@ public Report parse(final ReaderFactory readerFactory) {
}
}
+ @SuppressWarnings("PMD.DoNotUseThreads")
private void parseLine(final IssueBuilder builder, final Report warnings, final String line) {
Matcher fileMatcher = FILE_PATTERN.matcher(line);
if (fileMatcher.find()) {
diff --git a/src/main/java/edu/hm/hafner/analysis/parser/SbtScalacParser.java b/src/main/java/edu/hm/hafner/analysis/parser/SbtScalacParser.java
index 5c1240388..8fed693ce 100644
--- a/src/main/java/edu/hm/hafner/analysis/parser/SbtScalacParser.java
+++ b/src/main/java/edu/hm/hafner/analysis/parser/SbtScalacParser.java
@@ -10,7 +10,8 @@
import edu.hm.hafner.util.LookaheadStream;
/**
- * A parser for the sbt scala compiler warnings. You should use -feature and -deprecation compiler opts.
+ * A parser for the sbt scala compiler warnings. You should use {@code -feature} and {@code -deprecation} compiler
+ * opts.
*
* @author Hochak Hung
*/
@@ -18,6 +19,7 @@ public class SbtScalacParser extends LookaheadParser {
private static final long serialVersionUID = -4233964844965517977L;
private static final String SBT_WARNING_PATTERN = "^(\\[warn\\]|\\[error\\](?!\\s+Total\\stime:))\\s*(.*?):(\\d+)(?::\\d+)?:\\s*(.*)$";
+ private static final String ERROR = "[error]";
/**
* Creates a new instance of {@link SbtScalacParser}.
@@ -37,7 +39,7 @@ protected Optional createIssue(final Matcher matcher, final LookaheadStre
}
private Severity mapPriority(final Matcher matcher) {
- if ("[error]".equals(matcher.group(1))) {
+ if (ERROR.equals(matcher.group(1))) {
return Severity.WARNING_HIGH;
}
else {
diff --git a/src/main/java/edu/hm/hafner/analysis/parser/XlcCompilerParser.java b/src/main/java/edu/hm/hafner/analysis/parser/XlcCompilerParser.java
index a9a0f78aa..4e561677e 100644
--- a/src/main/java/edu/hm/hafner/analysis/parser/XlcCompilerParser.java
+++ b/src/main/java/edu/hm/hafner/analysis/parser/XlcCompilerParser.java
@@ -9,12 +9,14 @@
import edu.hm.hafner.analysis.LookaheadParser;
import edu.hm.hafner.analysis.Severity;
import edu.hm.hafner.util.LookaheadStream;
+import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
/**
* A parser for IBM xlC compiler warnings.
*
* @author Andrew Gvozdev
*/
+@SuppressFBWarnings("REDOS")
public class XlcCompilerParser extends LookaheadParser {
private static final long serialVersionUID = 5490211629355204910L;
diff --git a/src/main/java/edu/hm/hafner/analysis/parser/XlcLinkerParser.java b/src/main/java/edu/hm/hafner/analysis/parser/XlcLinkerParser.java
index 19fc154ec..5462875b6 100644
--- a/src/main/java/edu/hm/hafner/analysis/parser/XlcLinkerParser.java
+++ b/src/main/java/edu/hm/hafner/analysis/parser/XlcLinkerParser.java
@@ -9,12 +9,14 @@
import edu.hm.hafner.analysis.LookaheadParser;
import edu.hm.hafner.analysis.Severity;
import edu.hm.hafner.util.LookaheadStream;
+import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
/**
* A parser for IBM xlC linker warnings.
*
* @author Andrew Gvozdev
*/
+@SuppressFBWarnings("REDOS")
public class XlcLinkerParser extends LookaheadParser {
private static final long serialVersionUID = 211259620936831096L;
private static final String XLC_LINKER_WARNING_PATTERN = ANT_TASK + "ld: ([0-9]+-[0-9]+)*\\s*(.*)$";
diff --git a/src/main/java/edu/hm/hafner/analysis/parser/ccm/CcmParser.java b/src/main/java/edu/hm/hafner/analysis/parser/ccm/CcmParser.java
index e368149ff..f4a0363ec 100644
--- a/src/main/java/edu/hm/hafner/analysis/parser/ccm/CcmParser.java
+++ b/src/main/java/edu/hm/hafner/analysis/parser/ccm/CcmParser.java
@@ -106,9 +106,8 @@ private boolean isMetricHighPriority(final Metric metric) {
private boolean isMetricModeratePriority(final Metric metric) {
String metricClassification = metric.getClassification();
- if (StringUtils.contains(metricClassification, "moderate")) {
- return true;
- }
- return "B".equals(metricClassification);
+
+ return StringUtils.contains(metricClassification, "moderate")
+ || "B".equals(metricClassification);
}
}
diff --git a/src/main/java/edu/hm/hafner/analysis/parser/findbugs/FindBugsParser.java b/src/main/java/edu/hm/hafner/analysis/parser/findbugs/FindBugsParser.java
index 1a7564e58..84391c398 100644
--- a/src/main/java/edu/hm/hafner/analysis/parser/findbugs/FindBugsParser.java
+++ b/src/main/java/edu/hm/hafner/analysis/parser/findbugs/FindBugsParser.java
@@ -209,7 +209,7 @@ List preParse(final Reader file) throws SAXException, IOExceptio
digester.addCallMethod(fileXPath, "setMessage", 0);
digester.addSetNext(rootXPath, "add", Object.class.getName());
- ArrayList bugs = new ArrayList<>();
+ List bugs = new ArrayList<>();
digester.push(bugs);
digester.parse(file);
@@ -230,6 +230,7 @@ private Severity getPriority(final BugInstance warning) {
}
}
+ @SuppressWarnings("PMD.DoNotUseThreads")
private SortedBugCollection readXml(final Reader file) throws IOException, DocumentException {
ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader();
try {
diff --git a/src/main/java/edu/hm/hafner/analysis/parser/fxcop/FxCopParser.java b/src/main/java/edu/hm/hafner/analysis/parser/fxcop/FxCopParser.java
index f2f52f0d1..99962a147 100644
--- a/src/main/java/edu/hm/hafner/analysis/parser/fxcop/FxCopParser.java
+++ b/src/main/java/edu/hm/hafner/analysis/parser/fxcop/FxCopParser.java
@@ -16,12 +16,11 @@
/**
* Parses a fxcop xml report file.
- *
- * Note that instances of this parser are not thread safe.
*/
@SuppressWarnings("unused")
public class FxCopParser extends IssueParser {
private static final long serialVersionUID = -7208558002331355408L;
+ private static final int CAPACITY = 1024;
@Override
public Report parse(final ReaderFactory readerFactory) throws ParsingException, ParsingCanceledException {
@@ -164,7 +163,7 @@ private void parseIssue(final Element issue, final Element parent, final String
String checkId = getString(parent, "CheckId");
String issueLevel = getString(issue, "Level");
- StringBuilder msgBuilder = new StringBuilder();
+ StringBuilder msgBuilder = new StringBuilder(CAPACITY);
FxCopRule rule = ruleSet.getRule(category, checkId);
if (rule == null) {
msgBuilder.append(typeName);
diff --git a/src/main/java/edu/hm/hafner/analysis/parser/gendarme/GendarmeParser.java b/src/main/java/edu/hm/hafner/analysis/parser/gendarme/GendarmeParser.java
index 98da1317a..e7ad48b96 100644
--- a/src/main/java/edu/hm/hafner/analysis/parser/gendarme/GendarmeParser.java
+++ b/src/main/java/edu/hm/hafner/analysis/parser/gendarme/GendarmeParser.java
@@ -32,6 +32,9 @@ public class GendarmeParser extends IssueParser {
private static final long serialVersionUID = 1677715364464119907L;
private static final Pattern FILE_PATTERN = Pattern.compile("^(.*)\\(.(\\d+)\\).*$");
+ private static final String TYPE = "Type";
+ private static final String METHOD = "Method";
+ private static final String ASSEMBLY = "Assembly";
@Override
public Report parse(final ReaderFactory factory) throws ParsingException {
@@ -108,15 +111,19 @@ private Map parseRules(final List ruleElements) {
rule.setName(ruleElement.getAttribute("Name"));
rule.setTypeName(ruleElement.getTextContent());
- String typeString = ruleElement.getAttribute("Type");
- if ("Type".equals(typeString)) {
- rule.setType(GendarmeRuleType.Type);
- }
- else if ("Method".equals(typeString)) {
- rule.setType(GendarmeRuleType.Method);
- }
- else if ("Assembly".equals(typeString)) {
- rule.setType(GendarmeRuleType.Assembly);
+ String typeString = ruleElement.getAttribute(TYPE);
+ switch (typeString) {
+ case TYPE:
+ rule.setType(GendarmeRuleType.Type);
+ break;
+ case METHOD:
+ rule.setType(GendarmeRuleType.Method);
+ break;
+ case ASSEMBLY:
+ rule.setType(GendarmeRuleType.Assembly);
+ break;
+ default:
+ // ignore the type
}
try {
rule.setUrl(new URL(ruleElement.getAttribute("Uri")));
diff --git a/src/main/java/edu/hm/hafner/analysis/parser/pvsstudio/PVSStudioParser.java b/src/main/java/edu/hm/hafner/analysis/parser/pvsstudio/PVSStudioParser.java
index 85ee62b12..0beb0a86e 100644
--- a/src/main/java/edu/hm/hafner/analysis/parser/pvsstudio/PVSStudioParser.java
+++ b/src/main/java/edu/hm/hafner/analysis/parser/pvsstudio/PVSStudioParser.java
@@ -17,15 +17,18 @@
*/
public class PVSStudioParser extends IssueParser {
private static final long serialVersionUID = -7777775729854832128L;
+ private static final String SEVERITY_HIGH = "1";
+ private static final String SEVERITY_NORMAL = "2";
+ private static final String SEVERITY_LOW = "3";
private static Severity getSeverity(final String level) {
- if ("1".equals(level)) {
+ if (SEVERITY_HIGH.equals(level)) {
return Severity.WARNING_HIGH;
}
- else if ("2".equals(level)) {
+ else if (SEVERITY_NORMAL.equals(level)) {
return Severity.WARNING_NORMAL;
}
- else if ("3".equals(level)) {
+ else if (SEVERITY_LOW.equals(level)) {
return Severity.WARNING_LOW;
}
else {
diff --git a/src/main/java/edu/hm/hafner/analysis/parser/pylint/PyLintDescriptions.java b/src/main/java/edu/hm/hafner/analysis/parser/pylint/PyLintDescriptions.java
index ea405b60e..778a73af0 100644
--- a/src/main/java/edu/hm/hafner/analysis/parser/pylint/PyLintDescriptions.java
+++ b/src/main/java/edu/hm/hafner/analysis/parser/pylint/PyLintDescriptions.java
@@ -22,6 +22,7 @@ public class PyLintDescriptions {
/**
* Loads the available rules into a map.
*/
+ @SuppressWarnings("PMD.LooseCoupling")
public PyLintDescriptions() {
JSONParser parser = new JSONParser(JSONParser.MODE_JSON_SIMPLE);
diff --git a/src/main/java/edu/hm/hafner/analysis/parser/violations/PitAdapter.java b/src/main/java/edu/hm/hafner/analysis/parser/violations/PitAdapter.java
index cf6e5a832..53733893e 100644
--- a/src/main/java/edu/hm/hafner/analysis/parser/violations/PitAdapter.java
+++ b/src/main/java/edu/hm/hafner/analysis/parser/violations/PitAdapter.java
@@ -75,6 +75,6 @@ void extractAdditionalProperties(final IssueBuilder builder, final Violation vio
}
private String getMutationStatus(final Violation violation) {
- return violation.getSpecifics().getOrDefault(PitAdapter.STATUS, KILLED);
+ return violation.getSpecifics().getOrDefault(STATUS, KILLED);
}
}
diff --git a/src/main/java/edu/hm/hafner/analysis/registry/DryDescriptor.java b/src/main/java/edu/hm/hafner/analysis/registry/DryDescriptor.java
index ba7000e0d..d32580231 100644
--- a/src/main/java/edu/hm/hafner/analysis/registry/DryDescriptor.java
+++ b/src/main/java/edu/hm/hafner/analysis/registry/DryDescriptor.java
@@ -51,7 +51,7 @@ private int convertThreshold(final String key, final int defaultValue, final Opt
private String getDuplicateCode(@CheckForNull final Serializable properties) {
if (properties instanceof DuplicationGroup) {
- return pre().with(new UnescapedText(DryDescriptor.getCodeFragment((DuplicationGroup) properties)))
+ return pre().with(new UnescapedText(getCodeFragment((DuplicationGroup) properties)))
.renderFormatted();
}
else {
diff --git a/src/test/java/edu/hm/hafner/analysis/AntModuleDetectorTest.java b/src/test/java/edu/hm/hafner/analysis/AntModuleDetectorTest.java
index d36d670ee..c03256bba 100644
--- a/src/test/java/edu/hm/hafner/analysis/AntModuleDetectorTest.java
+++ b/src/test/java/edu/hm/hafner/analysis/AntModuleDetectorTest.java
@@ -37,9 +37,9 @@ void shouldIdentifyModuleByReadingAntProjectFile() {
});
ModuleDetector detector = new ModuleDetector(ROOT, factory);
- assertThat(detector.guessModuleName(PREFIX + (PATH_PREFIX_ANT + "something.txt")))
+ assertThat(detector.guessModuleName(PREFIX + PATH_PREFIX_ANT + "something.txt"))
.isEqualTo(EXPECTED_ANT_MODULE);
- assertThat(detector.guessModuleName(PREFIX + (PATH_PREFIX_ANT + "in/between/something.txt")))
+ assertThat(detector.guessModuleName(PREFIX + PATH_PREFIX_ANT + "in/between/something.txt"))
.isEqualTo(EXPECTED_ANT_MODULE);
assertThat(detector.guessModuleName(PREFIX + "path/to/something.txt"))
.isEqualTo(StringUtils.EMPTY);
diff --git a/src/test/java/edu/hm/hafner/analysis/GradleModuleDetectorTest.java b/src/test/java/edu/hm/hafner/analysis/GradleModuleDetectorTest.java
index ee4e111fe..b5e059da3 100644
--- a/src/test/java/edu/hm/hafner/analysis/GradleModuleDetectorTest.java
+++ b/src/test/java/edu/hm/hafner/analysis/GradleModuleDetectorTest.java
@@ -39,7 +39,7 @@ void shouldIdentifyModuleByReadingGradlePath() {
ModuleDetector detector = new ModuleDetector(ROOT, factory);
- assertThat(detector.guessModuleName(PREFIX + (PATH_PREFIX_GRADLE + "build/reports/something.txt")))
+ assertThat(detector.guessModuleName(PREFIX + PATH_PREFIX_GRADLE + "build/reports/something.txt"))
.isEqualTo(EXPECTED_GRADLE_MODULE_ROOT_BY_PATH);
assertThat(detector.guessModuleName(PREFIX + "build/reports/something.txt"))
.isEqualTo(StringUtils.EMPTY);
@@ -77,7 +77,7 @@ void shouldIdentifyModuleByReadingGradleKtsPath() {
ModuleDetector detector = new ModuleDetector(ROOT, factory);
- assertThat(detector.guessModuleName(PREFIX + (PATH_PREFIX_GRADLE + "build/reports/something.txt")))
+ assertThat(detector.guessModuleName(PREFIX + PATH_PREFIX_GRADLE + "build/reports/something.txt"))
.isEqualTo(EXPECTED_GRADLE_MODULE_ROOT_BY_PATH);
assertThat(detector.guessModuleName(PREFIX + "build/reports/something.txt"))
.isEqualTo(StringUtils.EMPTY);
diff --git a/src/test/java/edu/hm/hafner/analysis/IssuesInModifiedCodeMarkerTest.java b/src/test/java/edu/hm/hafner/analysis/IssuesInModifiedCodeMarkerTest.java
index c16332202..7454e64b7 100644
--- a/src/test/java/edu/hm/hafner/analysis/IssuesInModifiedCodeMarkerTest.java
+++ b/src/test/java/edu/hm/hafner/analysis/IssuesInModifiedCodeMarkerTest.java
@@ -22,7 +22,6 @@ void shouldNotMarkAnythingForEmptyMap() {
var marker = new IssuesInModifiedCodeMarker();
marker.markIssuesInModifiedCode(report, Map.of());
-
assertThatModifiedCodeMarkers(report).containsExactly(false, false);
assertThatIssuesToString(report).containsExactly(TO_STRING_UNMODIFIED, TO_STRING_UNMODIFIED);
}
diff --git a/src/test/java/edu/hm/hafner/analysis/MavenModuleDetectorTest.java b/src/test/java/edu/hm/hafner/analysis/MavenModuleDetectorTest.java
index f48595165..11c3b57b6 100644
--- a/src/test/java/edu/hm/hafner/analysis/MavenModuleDetectorTest.java
+++ b/src/test/java/edu/hm/hafner/analysis/MavenModuleDetectorTest.java
@@ -6,8 +6,7 @@
import edu.hm.hafner.analysis.ModuleDetector.FileSystem;
import static org.assertj.core.api.Assertions.*;
-import static org.mockito.ArgumentMatchers.any;
-import static org.mockito.ArgumentMatchers.anyString;
+import static org.mockito.ArgumentMatchers.*;
import static org.mockito.Mockito.*;
class MavenModuleDetectorTest extends AbstractModuleDetectorTest {
@@ -39,9 +38,9 @@ void shouldIdentifyModuleByReadingMavenPom() {
ModuleDetector detector = new ModuleDetector(ROOT, factory);
- assertThat(detector.guessModuleName(PREFIX + (PATH_PREFIX_MAVEN + "something.txt"))).isEqualTo(
+ assertThat(detector.guessModuleName(PREFIX + PATH_PREFIX_MAVEN + "something.txt")).isEqualTo(
EXPECTED_MAVEN_MODULE);
- assertThat(detector.guessModuleName(PREFIX + (PATH_PREFIX_MAVEN + "in/between/something.txt"))).isEqualTo(
+ assertThat(detector.guessModuleName(PREFIX + PATH_PREFIX_MAVEN + "in/between/something.txt")).isEqualTo(
EXPECTED_MAVEN_MODULE);
assertThat(detector.guessModuleName(PREFIX + "path/to/something.txt")).isEqualTo(StringUtils.EMPTY);
}
@@ -56,11 +55,11 @@ void shouldIdentifyModuleByReadingMavenPomWithoutName() {
ModuleDetector detector = new ModuleDetector(ROOT, factory);
String artifactId = "com.avaloq.adt.core";
- assertThat(detector.guessModuleName(PREFIX + (PATH_PREFIX_MAVEN + "something.txt")))
+ assertThat(detector.guessModuleName(PREFIX + PATH_PREFIX_MAVEN + "something.txt"))
.isEqualTo(artifactId);
- assertThat(detector.guessModuleName(PREFIX + (PATH_PREFIX_MAVEN + "in/between/something.txt")))
+ assertThat(detector.guessModuleName(PREFIX + PATH_PREFIX_MAVEN + "in/between/something.txt"))
.isEqualTo(artifactId);
assertThat(detector.guessModuleName(PREFIX + "path/to/something.txt"))
.isEqualTo(StringUtils.EMPTY);
}
-}
\ No newline at end of file
+}
diff --git a/src/test/java/edu/hm/hafner/analysis/ModuleDetectorTest.java b/src/test/java/edu/hm/hafner/analysis/ModuleDetectorTest.java
index edbdb0af2..f64b46317 100644
--- a/src/test/java/edu/hm/hafner/analysis/ModuleDetectorTest.java
+++ b/src/test/java/edu/hm/hafner/analysis/ModuleDetectorTest.java
@@ -50,9 +50,9 @@ void shouldIdentifyModuleIfThereAreMoreEntries() {
ModuleDetector detector = new ModuleDetector(ROOT, factory);
- assertThat(detector.guessModuleName(PREFIX + (PATH_PREFIX_ANT + "something.txt")))
+ assertThat(detector.guessModuleName(PREFIX + PATH_PREFIX_ANT + "something.txt"))
.isEqualTo(EXPECTED_ANT_MODULE);
- assertThat(detector.guessModuleName(PREFIX + (PATH_PREFIX_MAVEN + "something.txt")))
+ assertThat(detector.guessModuleName(PREFIX + PATH_PREFIX_MAVEN + "something.txt"))
.isEqualTo(EXPECTED_MAVEN_MODULE);
}
diff --git a/src/test/java/edu/hm/hafner/analysis/OsgiModuleDetectorTest.java b/src/test/java/edu/hm/hafner/analysis/OsgiModuleDetectorTest.java
index 8c81c53e8..f9e8da95b 100644
--- a/src/test/java/edu/hm/hafner/analysis/OsgiModuleDetectorTest.java
+++ b/src/test/java/edu/hm/hafner/analysis/OsgiModuleDetectorTest.java
@@ -6,8 +6,7 @@
import edu.hm.hafner.analysis.ModuleDetector.FileSystem;
import static org.assertj.core.api.Assertions.*;
-import static org.mockito.ArgumentMatchers.any;
-import static org.mockito.ArgumentMatchers.anyString;
+import static org.mockito.ArgumentMatchers.*;
import static org.mockito.Mockito.*;
/**
@@ -41,9 +40,9 @@ void shouldIdentifyModuleByReadingOsgiBundle() {
ModuleDetector detector = new ModuleDetector(ROOT, factory);
- assertThat(detector.guessModuleName(PREFIX + (PATH_PREFIX_OSGI + "something.txt")))
+ assertThat(detector.guessModuleName(PREFIX + PATH_PREFIX_OSGI + "something.txt"))
.isEqualTo(EXPECTED_OSGI_MODULE);
- assertThat(detector.guessModuleName(PREFIX + (PATH_PREFIX_OSGI + "in/between/something.txt")))
+ assertThat(detector.guessModuleName(PREFIX + PATH_PREFIX_OSGI + "in/between/something.txt"))
.isEqualTo(EXPECTED_OSGI_MODULE);
assertThat(detector.guessModuleName(PREFIX + "path/to/something.txt"))
.isEqualTo(StringUtils.EMPTY);
@@ -59,9 +58,9 @@ void shouldIdentifyModuleByReadingOsgiBundleWithVendorInL10nProperties() {
ModuleDetector detector = new ModuleDetector(ROOT, factory);
String expectedName = "de.faktorlogik.prototyp (My Vendor)";
- assertThat(detector.guessModuleName(PREFIX + (PATH_PREFIX_OSGI + "something.txt")))
+ assertThat(detector.guessModuleName(PREFIX + PATH_PREFIX_OSGI + "something.txt"))
.isEqualTo(expectedName);
- assertThat(detector.guessModuleName(PREFIX + (PATH_PREFIX_OSGI + "in/between/something.txt")))
+ assertThat(detector.guessModuleName(PREFIX + PATH_PREFIX_OSGI + "in/between/something.txt"))
.isEqualTo(expectedName);
assertThat(detector.guessModuleName(PREFIX + "path/to/something.txt"))
.isEqualTo(StringUtils.EMPTY);
@@ -78,11 +77,11 @@ void shouldIdentifyModuleByReadingOsgiBundleWithManifestName() {
ModuleDetector detector = new ModuleDetector(ROOT, fileSystem);
String expectedName = "My Bundle";
- assertThat(detector.guessModuleName(PREFIX + (PATH_PREFIX_OSGI + "something.txt")))
+ assertThat(detector.guessModuleName(PREFIX + PATH_PREFIX_OSGI + "something.txt"))
.isEqualTo(expectedName);
- assertThat(detector.guessModuleName(PREFIX + (PATH_PREFIX_OSGI + "in/between/something.txt")))
+ assertThat(detector.guessModuleName(PREFIX + PATH_PREFIX_OSGI + "in/between/something.txt"))
.isEqualTo(expectedName);
assertThat(detector.guessModuleName(PREFIX + "path/to/something.txt"))
.isEqualTo(StringUtils.EMPTY);
}
-}
\ No newline at end of file
+}
diff --git a/src/test/java/edu/hm/hafner/analysis/ReportTest.java b/src/test/java/edu/hm/hafner/analysis/ReportTest.java
index 28ee5acbb..484a341d5 100644
--- a/src/test/java/edu/hm/hafner/analysis/ReportTest.java
+++ b/src/test/java/edu/hm/hafner/analysis/ReportTest.java
@@ -848,7 +848,7 @@ void shouldWriteLongMessages() {
private String createLongMessage() {
char[] chars = new char[100_000];
- return new String(chars);
+ return String.valueOf(chars);
}
/** Verifies that equals checks all properties. */
diff --git a/src/test/java/edu/hm/hafner/analysis/registry/ParsersTest.java b/src/test/java/edu/hm/hafner/analysis/registry/ParsersTest.java
index 426d63b40..f4e951182 100644
--- a/src/test/java/edu/hm/hafner/analysis/registry/ParsersTest.java
+++ b/src/test/java/edu/hm/hafner/analysis/registry/ParsersTest.java
@@ -14,7 +14,7 @@
import static edu.hm.hafner.analysis.assertions.Assertions.*;
/**
- * Integration tests of all parsers of the warnings plug-in in pipelines.
+ * Integration tests of all parsers.
*
* @author Ullrich Hafner
*/