Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow passing multiple options in the "Advanced" group #1301

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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());
}
}
Loading