当前位置: 首页>>代码示例>>Java>>正文


Java TestResult.wasSuccessful方法代码示例

本文整理汇总了Java中junit.framework.TestResult.wasSuccessful方法的典型用法代码示例。如果您正苦于以下问题:Java TestResult.wasSuccessful方法的具体用法?Java TestResult.wasSuccessful怎么用?Java TestResult.wasSuccessful使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在junit.framework.TestResult的用法示例。


在下文中一共展示了TestResult.wasSuccessful方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: printFooter

import junit.framework.TestResult; //导入方法依赖的package包/类
protected void printFooter(TestResult result) {
    if (result.wasSuccessful()) {
        getWriter().println("OK (" + result.runCount() + " tests)"
            + "  Time: " + elapsedTimeAsString(runTime));
    } else {
        getWriter().println("Time: " + elapsedTimeAsString(runTime));
        super.printFooter(result);
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:10,代码来源:JSR166TestCase.java

示例2: main

import junit.framework.TestResult; //导入方法依赖的package包/类
/**
 * Runs all unit tests in the given test suite.
 * Actual behavior influenced by jsr166.* system properties.
 */
static void main(Test suite, String[] args) {
    if (useSecurityManager) {
        System.err.println("Setting a permissive security manager");
        Policy.setPolicy(permissivePolicy());
        System.setSecurityManager(new SecurityManager());
    }
    for (int i = 0; i < suiteRuns; i++) {
        TestResult result = newPithyTestRunner().doRun(suite);
        if (!result.wasSuccessful())
            System.exit(1);
        System.gc();
        System.runFinalization();
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:19,代码来源:JSR166TestCase.java

示例3: executeTest

import junit.framework.TestResult; //导入方法依赖的package包/类
protected void executeTest(Class test, Permission missingPermission) {
    TestSuite suite = new TestSuite();
    suite.addTestSuite(test);
    TestResult result = new TestResult();
    suite.run(result);
    if (result.wasSuccessful()) {
        if (missingPermission == null) {
            return;
        } else {
            fail("Security test expected an AccessControlException on " + missingPermission + ", but did not receive one");
        }
    } else {
        if (missingPermission == null) {
            new SecurityTestResultPrinter(System.out).print(result);
            fail("Security test was expected to run successfully, but failed (results on System.out)");
        } else {
            //There may be more than 1 failure:  iterate to ensure that they all match the missingPermission.
            boolean otherFailure = false;
            for (Enumeration e = result.errors(); e.hasMoreElements();) {
                TestFailure failure = (TestFailure) e.nextElement();
                if (failure.thrownException() instanceof AccessControlException) {
                    AccessControlException ace = (AccessControlException) failure.thrownException();
                    if (missingPermission.implies(ace.getPermission())) {
                        continue;
                    }
                }
                otherFailure = true;
                break;
            }
            if (otherFailure) {
                new SecurityTestResultPrinter(System.out).print(result);
                fail("Security test expected an AccessControlException on " + missingPermission + ", but failed for other reasons (results on System.out)");
            }
        }
    }
}
 
开发者ID:apache,项目名称:groovy,代码行数:37,代码来源:SecurityTestSupport.java

示例4: main

import junit.framework.TestResult; //导入方法依赖的package包/类
public static void main(String args[]) {
	TestRunner aTestRunner= new TestRunner();
	try {
		TestResult r= aTestRunner.start(args);
		if (!r.wasSuccessful()) 
			System.exit(FAILURE_EXIT);
		System.exit(SUCCESS_EXIT);
	} catch(Exception e) {
		System.err.println(e.getMessage());
		System.exit(EXCEPTION_EXIT);
	}
}
 
开发者ID:mpgerstl,项目名称:tEFMA,代码行数:13,代码来源:TestRunner.java

示例5: main

import junit.framework.TestResult; //导入方法依赖的package包/类
public static void main(String[] argv) {
  VerboseTestRunner runner = new VerboseTestRunner();
  try {
    TestResult result = runner.start(argv);
    if (!result.wasSuccessful()) {
      System.exit(FAILURE_EXIT);
    }
    System.exit(SUCCESS_EXIT);
  } catch (Exception ex) {
    ex.printStackTrace();
    System.exit(EXCEPTION_EXIT);
  }
}
 
开发者ID:OWASP,项目名称:java-html-sanitizer,代码行数:14,代码来源:VerboseTestRunner.java

示例6: printFooter

import junit.framework.TestResult; //导入方法依赖的package包/类
protected void printFooter(TestResult result) {
    if (result.wasSuccessful()) {
        getWriter().println();
        getWriter().print("OK");
        getWriter().println (" (" + result.runCount() + " test" + (result.runCount() == 1 ? "": "s") + ")");

    } else {
        getWriter().println();
        getWriter().println("FAILURES!!!");
        getWriter().println("Tests run: "+result.runCount()+
                     ",  Failures: "+result.failureCount()+
                     ",  Errors: "+result.errorCount());
    }
    getWriter().println();
}
 
开发者ID:keplersj,项目名称:In-the-Box-Fork,代码行数:16,代码来源:ResultPrinter.java

示例7: main

import junit.framework.TestResult; //导入方法依赖的package包/类
/**
 * Provides the main entry point. First and second argument are class and
 * method name, respectively. Third argument is the temporary file name for
 * the result. Exits with one of the usual JUnit exit values.
 */
public static void main(String args[]) {
    Logger.global.setLevel(Level.OFF);

    CoreTestIsolator testRunner = new CoreTestIsolator();
    try {
        TestResult r = testRunner.start(args);

        if (!r.wasSuccessful()) {
            // Store failure or error - we know there must be one
            Throwable failure = r.failureCount() != 0 ?
                    ((TestFailure)r.failures().nextElement()).
                            thrownException() :
                    ((TestFailure)r.errors().nextElement()).
                            thrownException();

            saveStackTrace(failure, args[2]);

            System.exit(FAILURE_EXIT);
        } else {
            // Nothing to see here, please get along
            System.exit(SUCCESS_EXIT);
        }
    } catch(Exception e) {
        // Let main TestRunner know about execution problem
        saveStackTrace(e, args[2]);
        System.exit(EXCEPTION_EXIT);
    }

}
 
开发者ID:keplersj,项目名称:In-the-Box-Fork,代码行数:35,代码来源:CoreTestIsolator.java

示例8: main

import junit.framework.TestResult; //导入方法依赖的package包/类
/**
 * Provides our main entry point.
 */
public static void main(String args[]) {
    Logger.global.setLevel(Level.OFF);

    System.out.println(
            "--------------------------------------------------");
    System.out.println("Android Core Libraries Test Suite");
    System.out.println("Version 1.0");
    System.out.println(
            "Copyright (c) 2009 The Android Open Source Project");
    System.out.println("");

    CoreTestRunner testRunner = new CoreTestRunner();
    try {
        TestResult r = testRunner.start(args);

        System.out.println(
        "--------------------------------------------------");

        if (!r.wasSuccessful()) {
            System.exit(FAILURE_EXIT);
        } else {
            System.exit(SUCCESS_EXIT);
        }
    } catch(Exception e) {
        System.err.println(e.getMessage());
        System.exit(EXCEPTION_EXIT);
    }

}
 
开发者ID:keplersj,项目名称:In-the-Box-Fork,代码行数:33,代码来源:CoreTestRunner.java

示例9: main

import junit.framework.TestResult; //导入方法依赖的package包/类
public static void main(String args[]) {
    StatTestRunner aTestRunner= new StatTestRunner();
    try {
        TestResult r= aTestRunner.start(args);
        if (!r.wasSuccessful())
            System.exit(FAILURE_EXIT);
        System.exit(SUCCESS_EXIT);
    } catch(Exception e) {
        System.err.println(e.getMessage());
        System.exit(EXCEPTION_EXIT);
    }
}
 
开发者ID:keplersj,项目名称:In-the-Box-Fork,代码行数:13,代码来源:StatTestRunner.java

示例10: main

import junit.framework.TestResult; //导入方法依赖的package包/类
public static void main(String args[]) {
    TestRunner aTestRunner = new TestRunner();
    try {
        TestResult r = aTestRunner.start(args);
        if (!r.wasSuccessful()) {
            System.exit(FAILURE_EXIT);
        }
        System.exit(SUCCESS_EXIT);
    } catch (Exception e) {
        System.err.println(e.getMessage());
        System.exit(EXCEPTION_EXIT);
    }
}
 
开发者ID:DIVERSIFY-project,项目名称:sosiefier,代码行数:14,代码来源:TestRunner.java

示例11: printFooter

import junit.framework.TestResult; //导入方法依赖的package包/类
protected void printFooter(TestResult result) {
    if (result.wasSuccessful()) {
        getWriter().println();
        getWriter().print("OK");
        getWriter().println(" (" + result.runCount() + " test" + (result.runCount() == 1 ? "" : "s") + ")");

    } else {
        getWriter().println();
        getWriter().println("FAILURES!!!");
        getWriter().println("Tests run: " + result.runCount() +
                ",  Failures: " + result.failureCount() +
                ",  Errors: " + result.errorCount());
    }
    getWriter().println();
}
 
开发者ID:DIVERSIFY-project,项目名称:sosiefier,代码行数:16,代码来源:ResultPrinter.java

示例12: displayResults

import junit.framework.TestResult; //导入方法依赖的package包/类
protected void displayResults( PrintWriter writer, TestResult testResult ) {
    if (!testResult.wasSuccessful()) {
        displayProblems( writer, "failure", testResult.failureCount(), testResult.failures() );
        displayProblems( writer, "error", testResult.errorCount(), testResult.errors() );
    }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:7,代码来源:JUnitServlet.java

示例13: main

import junit.framework.TestResult; //导入方法依赖的package包/类
public static void main(String[] args) {
	TestResult result = junit.textui.TestRunner.run(suite());
	if (!result.wasSuccessful())
		System.exit(1);
}
 
开发者ID:iwabuchiken,项目名称:freemind_1.0.0_20140624_214725,代码行数:6,代码来源:AllTests.java


注:本文中的junit.framework.TestResult.wasSuccessful方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。