diff --git a/cli/src/main/java/de/jplag/cli/CliOptions.java b/cli/src/main/java/de/jplag/cli/CliOptions.java index 573707b86..c55e71f3b 100644 --- a/cli/src/main/java/de/jplag/cli/CliOptions.java +++ b/cli/src/main/java/de/jplag/cli/CliOptions.java @@ -53,7 +53,7 @@ public class CliOptions implements Runnable { "--result-directory"}, description = "Name of the directory in which the comparison results will be stored (default: result)%n") public String resultFolder = "results"; - @ArgGroup(heading = "Advanced%n") + @ArgGroup(heading = "Advanced%n", exclusive = false) public Advanced advanced = new Advanced(); @ArgGroup(validate = false, heading = "Clustering%n") diff --git a/cli/src/test/java/de/jplag/cli/AdvancedGroupTest.java b/cli/src/test/java/de/jplag/cli/AdvancedGroupTest.java new file mode 100644 index 000000000..bc88af731 --- /dev/null +++ b/cli/src/test/java/de/jplag/cli/AdvancedGroupTest.java @@ -0,0 +1,23 @@ +package de.jplag.cli; + +import static org.junit.jupiter.api.Assertions.assertEquals; + +import java.util.Arrays; + +import org.junit.jupiter.api.Test; + +class AdvancedGroupTest extends CommandLineInterfaceTest { + private static final String SUFFIXES = ".sc,.scala"; + + private static final double SIMILARITY_THRESHOLD = 0.5; + + /** + * Verify that it is possible to set multiple options in the "advanced" options group. + */ + @Test + void testNotExclusive() throws CliException { + buildOptionsFromCLI(defaultArguments().suffixes(SUFFIXES).similarityThreshold(SIMILARITY_THRESHOLD)); + assertEquals(Arrays.stream(SUFFIXES.split(",")).toList(), options.fileSuffixes()); + assertEquals(0.5, options.similarityThreshold()); + } +}