diff --git a/apache-rat-core/src/main/java/org/apache/rat/OptionCollection.java b/apache-rat-core/src/main/java/org/apache/rat/OptionCollection.java
index 7a993cb99..d7e51bc42 100644
--- a/apache-rat-core/src/main/java/org/apache/rat/OptionCollection.java
+++ b/apache-rat-core/src/main/java/org/apache/rat/OptionCollection.java
@@ -130,7 +130,7 @@ public static ReportConfiguration parseCommands(final File workingDirectory, fin
CommandLine commandLine;
try {
commandLine = DefaultParser.builder().setDeprecatedHandler(DeprecationReporter.getLogReporter())
- .setAllowPartialMatching(true).build().parse(opts, args);
+ .setAllowPartialMatching(true).get().parse(opts, args);
} catch (ParseException e) {
DefaultLog.getInstance().error(e.getMessage());
DefaultLog.getInstance().error("Please use the \"--help\" option to see a list of valid commands and options.", e);
diff --git a/apache-rat-core/src/test/java/org/apache/rat/help/HelpTest.java b/apache-rat-core/src/test/java/org/apache/rat/help/HelpTest.java
index e3e994765..a844d7b0a 100644
--- a/apache-rat-core/src/test/java/org/apache/rat/help/HelpTest.java
+++ b/apache-rat-core/src/test/java/org/apache/rat/help/HelpTest.java
@@ -42,10 +42,10 @@ public void verifyAllOptionsListed() {
for (Option option : opts.getOptions()) {
if (option.getOpt() != null) {
- TextUtils.assertContains("-" + option.getOpt() + (option.getLongOpt() == null ? " " : ","), result);
+ TextUtils.assertContains(option, "-" + option.getOpt() + (option.getLongOpt() == null ? " " : ","), result);
}
if (option.getLongOpt() != null) {
- TextUtils.assertContains("--" + option.getLongOpt() + " ", result);
+ TextUtils.assertContains(option, "--" + option.getLongOpt() + " ", result);
}
}
diff --git a/apache-rat-core/src/test/java/org/apache/rat/testhelpers/TextUtils.java b/apache-rat-core/src/test/java/org/apache/rat/testhelpers/TextUtils.java
index e90a30b9c..68e31a5f7 100644
--- a/apache-rat-core/src/test/java/org/apache/rat/testhelpers/TextUtils.java
+++ b/apache-rat-core/src/test/java/org/apache/rat/testhelpers/TextUtils.java
@@ -26,6 +26,8 @@
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.util.regex.Pattern;
+
+import org.apache.commons.cli.Option;
import org.apache.commons.io.IOUtils;
/**
@@ -78,6 +80,18 @@ public static void assertContains(final String find, final String target) {
.isTrue();
}
+ /**
+ * Asserts that a string is contained within another string and allows to print the related option.
+ * @param option The current option to search in via parameter find.
+ * @param find The string to find.
+ * @param target The string to search.
+ */
+ public static void assertContains(final Option option, final String find, final String target) {
+ assertThat(target.contains(find)).as(() ->
+ format("Target option '%s' is not properly found in the text: %s%n%s", option, find, target))
+ .isTrue();
+ }
+
/**
* Asserts that a string is contained exactly a specified number of times within another string.
* @param times The number of times to find the string in the target.
diff --git a/pom.xml b/pom.xml
index 31c78b8a1..13918d541 100644
--- a/pom.xml
+++ b/pom.xml
@@ -123,7 +123,7 @@ agnostic home for software distribution comprehension and audit tools.
commons-cli
commons-cli
- 1.8.0
+ 1.11.0
org.apache.commons