测试将无法正确运行尝试运行 JUnit 测试错误
package picocli;
import picocli.CommandLine.Option;
public class ComparatorRunnerConfig {
@Option(names = {"-rc", "--report-class"}, required = false,
description = "define report")
private String report;
public String getReport() {
return report;
}
}
我的 JUnit 测试:
package picocli;
import static org.junit.Assert.*;
import org.junit.Test;
public class ConfigurationTest {
@Test
public void testBasicConfigOptions() {
String args = "-rc BlahBlah";
ComparatorRunnerConfig mfc = new ComparatorRunnerConfig();
new CommandLine(mfc).parse(args);
String myTestValue = mfc.getReport();
assertEquals(myTestValue, "BlahBlah");
}
}
测试失败。