Java Code Examples for junit.framework.Test#toString()

The following examples show how to use junit.framework.Test#toString() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: UIMAResultPrinter.java    From uima-uimaj with Apache License 2.0 6 votes vote down vote up
/**
 * @see junit.framework.TestListener#startTest(Test)
 */
public void startTest(Test test) {
  this.testCounter++;
  String name = test.toString();
  String tempCurrentTestClass = name.substring(name.indexOf('(') + 1, name.lastIndexOf(')'));
  String testName = name.substring(0, name.indexOf('('));

  if (!tempCurrentTestClass.equals(this.currentTestClass)) {
    this.currentTestClass = tempCurrentTestClass;
    getWriter().println();
    getWriter().println();
    getWriter().print(this.currentTestClass);
    getWriter().println();
    for (int i = 0; i < this.currentTestClass.length(); i++)
      getWriter().print("=");
  }

  getWriter().println();
  getWriter().print(this.testCounter + ":  " + testName + ": ");
  if (this.fColumn++ >= 40 || this.teeOutputStream) {
    getWriter().println();
    this.fColumn = 0;
  }
}
 
Example 2
Source File: TestTreeItemCell.java    From marathonv5 with Apache License 2.0 4 votes vote down vote up
@Override
protected void updateItem(Test test, boolean empty) {
    super.updateItem(test, empty);
    if (test != null && !empty) {
        String value;
        if (test instanceof TestSuite) {
            value = ((TestSuite) test).getName();
        } else if (test instanceof MarathonTestCase) {
            value = ((MarathonTestCase) test).getName();
        } else {
            value = test.toString();
        }
        setText(value);
        Node icon = test instanceof TestSuite ? FXUIUtils.getIcon("tsuite") : FXUIUtils.getIcon("ttest");
        State state = ((TestTreeItem) getTreeItem()).getState();

        if (test instanceof TestSuite) {
            if (state == State.RUNNING) {
                icon = FXUIUtils.getIcon("wait16trans");
            }
            if (state == State.SUCCESS) {
                icon = FXUIUtils.getIcon("tsuiteok");
            }
            if (state == State.ERROR) {
                icon = FXUIUtils.getIcon("tsuiteerror");
            }
            if (state == State.FAILURE) {
                icon = FXUIUtils.getIcon("tsuitefail");
            }
        } else {
            if (state == State.RUNNING) {
                icon = FXUIUtils.getIcon("wait16trans");
            }
            if (state == State.SUCCESS) {
                icon = FXUIUtils.getIcon("testok");
            }
            if (state == State.ERROR) {
                icon = FXUIUtils.getIcon("testerror");
            }
            if (state == State.FAILURE) {
                icon = FXUIUtils.getIcon("testfail");
            }
        }
        setGraphic(icon);
    } else {
        setText(null);
        setGraphic(null);
    }
}
 
Example 3
Source File: SecurityManagerSetup.java    From gemfirexd-oss with Apache License 2.0 3 votes vote down vote up
/**
 * Get a decorator that will ensure no security manger
 * is installed to run a test. Not supported for suites.
 * <BR>
 * An empty suite is returned if a security manager was installed
 * externally, i.e. not under the control of the BaseTestCase
 * and this code. In this case the code can not support the
 * mode of no security manager as it may not have enough information
 * to re-install the security manager. So the passed in test
 * will be skipped.
    * 
    * @param test Test to run without a security manager. Note that
    * this must be an instance of BaseTestCase as this call depends
    * on setup code in that class. Arbitrary Test instances cannot be passed in.
 */
public static Test noSecurityManager(Test test)
{
	if (externalSecurityManagerInstalled)
		return new TestSuite("skipped due to external security manager "
                   + test.toString());
	return new SecurityManagerSetup(test, "<NONE>");
}
 
Example 4
Source File: SecurityManagerSetup.java    From gemfirexd-oss with Apache License 2.0 3 votes vote down vote up
/**
 * Get a decorator that will ensure no security manger
 * is installed to run a test. Not supported for suites.
 * <BR>
 * An empty suite is returned if a security manager was installed
 * externally, i.e. not under the control of the BaseTestCase
 * and this code. In this case the code can not support the
 * mode of no security manager as it may not have enough information
 * to re-install the security manager. So the passed in test
 * will be skipped.
    * 
    * @param test Test to run without a security manager. Note that
    * this must be an instance of BaseTestCase as this call depends
    * on setup code in that class. Arbitrary Test instances cannot be passed in.
 */
public static Test noSecurityManager(Test test)
{
	if (externalSecurityManagerInstalled)
		return new TestSuite("skipped due to external security manager "
                   + test.toString());
	return new SecurityManagerSetup(test, "<NONE>");
}
 
Example 5
Source File: SecurityManagerSetup.java    From spliceengine with GNU Affero General Public License v3.0 3 votes vote down vote up
/**
 * Get a decorator that will ensure no security manger
 * is installed to run a test. Not supported for suites.
 * <BR>
 * An empty suite is returned if a security manager was installed
 * externally, i.e. not under the control of the BaseTestCase
 * and this code. In this case the code can not support the
 * mode of no security manager as it may not have enough information
 * to re-install the security manager. So the passed in test
 * will be skipped.
    * 
    * @param test Test to run without a security manager. Note that
    * this must be an instance of BaseTestCase as this call depends
    * on setup code in that class. Arbitrary Test instances cannot be passed in.
 */
public static Test noSecurityManager(Test test)
{
	if (externalSecurityManagerInstalled)
		return new TestSuite("skipped due to external security manager "
                   + test.toString());
       return new SecurityManagerSetup(test, NO_POLICY);
}