Skip to content

Commit

Permalink
Merge pull request #1301 from CodeGra-de/bugfix/allow-passing-multipl…
Browse files Browse the repository at this point in the history
…e-advanced-args

Allow passing multiple options in the "Advanced" group
  • Loading branch information
tsaglam authored Sep 26, 2023
2 parents 094fab8 + 36dae0f commit 7ca56ff
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
2 changes: 1 addition & 1 deletion cli/src/main/java/de/jplag/cli/CliOptions.java
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
23 changes: 23 additions & 0 deletions cli/src/test/java/de/jplag/cli/AdvancedGroupTest.java
Original file line number Diff line number Diff line change
@@ -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());
}
}

0 comments on commit 7ca56ff

Please sign in to comment.