本文整理汇总了Java中junit.runner.Version类的典型用法代码示例。如果您正苦于以下问题:Java Version类的具体用法?Java Version怎么用?Java Version使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Version类属于junit.runner包,在下文中一共展示了Version类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: newRunListener
import junit.runner.Version; //导入依赖的package包/类
/**
* Returns a new {@link RunListener} instance for the given {@param outputFormat}.
*/
public RunListener newRunListener(OutputFormat outputFormat) {
switch (outputFormat) {
case JUNIT:
out.println("JUnit version " + Version.id());
return new TextListener(out);
case GTM_UNIT_TESTING:
return new GtmUnitTestingTextListener();
default:
throw new IllegalArgumentException("outputFormat");
}
}
示例2: newRunListener
import junit.runner.Version; //导入依赖的package包/类
/**
* Returns a new {@link RunListener} instance for the given {@param outputFormat}.
*/
public RunListener newRunListener(OutputFormat outputFormat) {
switch (outputFormat) {
case JUNIT:
out.println("JUnit version " + Version.id());
return new TextListener(out);
case GTM_UNIT_TESTING:
return new GtmUnitTestingTextListener();
default:
throw new IllegalArgumentException("outputFormat");
}
}
示例3: start
import junit.runner.Version; //导入依赖的package包/类
/**
* Starts a test run. Analyzes the command line arguments
* and runs the given test suite.
*/
@Override
public TestResult start(String args[]) throws Exception {
String testCase= "";
boolean wait= false;
for (int i= 0; i < args.length; i++) {
if (args[i].equals("-wait"))
wait= true;
else if (args[i].equals("-c"))
testCase= extractClassName(args[++i]);
else if (args[i].equals("-v"))
System.err.println("JUnit "+Version.id()+" by Kent Beck and Erich Gamma");
else
testCase= args[i];
}
if (testCase.equals(""))
throw new Exception("Usage: TestName[#testCaseName] [-wait], where TestName is the name of the TestCase class, testCaseName that of a test method");
try {
Test suite= getTest(testCase);
return doRun(suite, wait);
}
catch(Exception e) {
throw new Exception("Could not create and run test suite: "+e);
}
}
示例4: start
import junit.runner.Version; //导入依赖的package包/类
/**
* Starts a test run. Analyzes the command line arguments and runs the given
* test suite.
*/
public TestResult start(String args[]) throws Exception {
String testCase = "";
String method = "";
boolean wait = false;
for (int i = 0; i < args.length; i++) {
if (args[i].equals("-wait")) {
wait = true;
} else if (args[i].equals("-c")) {
testCase = extractClassName(args[++i]);
} else if (args[i].equals("-m")) {
String arg = args[++i];
int lastIndex = arg.lastIndexOf('.');
testCase = arg.substring(0, lastIndex);
method = arg.substring(lastIndex + 1);
} else if (args[i].equals("-v")) {
System.err.println("JUnit " + Version.id() + " by Kent Beck and Erich Gamma");
} else {
testCase = args[i];
}
}
if (testCase.equals("")) {
throw new Exception("Usage: TestRunner [-wait] testCaseName, where name is the name of the TestCase class");
}
try {
if (!method.equals("")) {
return runSingleMethod(testCase, method, wait);
}
Test suite = getTest(testCase);
return doRun(suite, wait);
} catch (Exception e) {
throw new Exception("Could not create and run test suite: " + e);
}
}
示例5: runMain
import junit.runner.Version; //导入依赖的package包/类
/**
* @param system
* @param args from main()
*/
Result runMain(JUnitSystem system, String... args) {
system.out().println("JUnit version " + Version.id());
JUnitCommandLineParseResult jUnitCommandLineParseResult = JUnitCommandLineParseResult.parse(args);
RunListener listener = new TextListener(system);
addListener(listener);
return run(jUnitCommandLineParseResult.createRequest(defaultComputer()));
}
示例6: getVersion
import junit.runner.Version; //导入依赖的package包/类
/**
* @return the version number of this release
*/
public String getVersion() {
return Version.id();
}
示例7: testVersion
import junit.runner.Version; //导入依赖的package包/类
@Test(timeout = 20L, expected = Test.None.class)
public void testVersion() {
org.junit.Assert.assertEquals("4.12", Version.id());
}
示例8: getJUnitVersion
import junit.runner.Version; //导入依赖的package包/类
public static String getJUnitVersion() {
return Version.id();
}
示例9: start
import junit.runner.Version; //导入依赖的package包/类
/**
* Starts a test run. Analyzes the command line arguments
* and runs the given test suite.
*
* @param args The command line arguments.
*
* @return The test results.
*
* @throws Exception Any exceptions falling through the tests are wrapped in Exception and rethrown.
*/
public TestResult start(String[] args) throws Exception
{
String testCase = "";
boolean wait = false;
for (int i = 0; i < args.length; i++)
{
if (args[i].equals("-wait"))
{
wait = true;
}
else if (args[i].equals("-c"))
{
testCase = extractClassName(args[++i]);
}
else if (args[i].equals("-v"))
{
System.err.println("JUnit " + Version.id() + " by Kent Beck and Erich Gamma");
}
else
{
testCase = args[i];
}
}
if (testCase.equals(""))
{
throw new Exception("Usage: TestRunner [-wait] testCaseName, where name is the name of the TestCase class");
}
try
{
Test suite = getTest(testCase);
return doRun(suite, wait);
}
catch (Exception e)
{
log.warn("Got exception whilst creating and running test suite.", e);
throw new Exception("Could not create and run the test suite.", e);
}
}