Example usage for junit.framework Test getClass

List of usage examples for junit.framework Test getClass

Introduction

In this page you can find the example usage for junit.framework Test getClass.

Prototype

@HotSpotIntrinsicCandidate
public final native Class<?> getClass();

Source Link

Document

Returns the runtime class of this Object .

Usage

From source file:org.jahia.bin.TestServlet.java

private List<Class> getTestClasses(Test test, List<Class> classes) {
    if (test instanceof TestSuite) {
        // if there is a suite method available, then try
        // to extract the suite from it. If there is an error
        // here it will be caught below and reported.
        Set<Class> tempClasses = new HashSet<Class>();
        for (Enumeration<Test> tests = ((TestSuite) test).tests(); tests.hasMoreElements();) {
            Test currentTest = tests.nextElement();
            if (currentTest instanceof TestSuite || !tempClasses.contains(currentTest.getClass())) {
                classes = getTestClasses(currentTest, classes);
                tempClasses.add(currentTest.getClass());
            }//from  w  w  w . j  ava 2 s. c  o m
        }
    } else {
        classes.add(test.getClass());
    }
    return classes;
}

From source file:org.jahia.test.bin.TestServlet.java

private List<Class<?>> getTestClasses(Test test, List<Class<?>> classes) {
    if (test instanceof TestSuite) {
        // if there is a suite method available, then try
        // to extract the suite from it. If there is an error
        // here it will be caught below and reported.
        Set<Class<?>> tempClasses = new HashSet<Class<?>>();
        for (Enumeration<Test> tests = ((TestSuite) test).tests(); tests.hasMoreElements();) {
            Test currentTest = tests.nextElement();
            if (currentTest instanceof TestSuite || !tempClasses.contains(currentTest.getClass())) {
                classes = getTestClasses(currentTest, classes);
                tempClasses.add(currentTest.getClass());
            }// w  w  w.  j ava 2  s  .c o m
        }
    } else {
        classes.add(test.getClass());
    }
    return classes;
}