Package gw.test

Class TestClass

    • Field Detail

      • _pkgName

        private java.lang.String _pkgName
      • _className

        private java.lang.String _className
      • THREAD_LOCAL_EXECUTION_MANAGER

        private static final java.lang.ThreadLocal<TestExecutionManager> THREAD_LOCAL_EXECUTION_MANAGER
      • _doNotRun

        private boolean _doNotRun
      • _knownBreak

        private boolean _knownBreak
      • _numberOfInstancesCreatedByTypeName

        private static final java.util.Map<java.lang.String,​java.lang.Integer> _numberOfInstancesCreatedByTypeName
      • _isGosuTest

        private boolean _isGosuTest
      • _skipKnownBreakTests

        private static java.lang.Boolean _skipKnownBreakTests
    • Constructor Detail

      • TestClass

        protected TestClass()
      • TestClass

        protected TestClass​(java.lang.String s)
      • TestClass

        protected TestClass​(boolean shouldInit)
      • TestClass

        protected TestClass​(java.lang.String s,
                            boolean shouldInit)
    • Method Detail

      • isGosuTest

        public boolean isGosuTest()
      • setGosuTest

        public void setGosuTest​(boolean gosuTest)
      • initInternalData

        protected void initInternalData()
      • getFullClassNameInternal

        protected java.lang.String getFullClassNameInternal()
      • getNumberOfInstancesOfTestClassCreated

        public static java.lang.Integer getNumberOfInstancesOfTestClassCreated​(java.lang.String typeName)
      • setUp

        protected final void setUp()
                            throws java.lang.Exception
        Overrides:
        setUp in class junit.framework.TestCase
        Throws:
        java.lang.Exception
      • tearDown

        protected final void tearDown()
                               throws java.lang.Exception
        Overrides:
        tearDown in class junit.framework.TestCase
        Throws:
        java.lang.Exception
      • beforeTestClass

        public void beforeTestClass()
      • beforeTestMethod

        public void beforeTestMethod()
      • afterTestMethod

        public void afterTestMethod​(java.lang.Throwable possibleException)
      • afterTestClass

        public void afterTestClass()
      • run

        public void run​(junit.framework.TestResult result)
        Specified by:
        run in interface junit.framework.Test
        Overrides:
        run in class junit.framework.TestCase
      • reallyRun

        public void reallyRun​(junit.framework.TestResult result)
      • runBare

        public void runBare()
                     throws java.lang.Throwable
        Overrides:
        runBare in class junit.framework.TestCase
        Throws:
        java.lang.Throwable
      • reallyRunBare

        public void reallyRunBare()
                           throws java.lang.Throwable
        Throws:
        java.lang.Throwable
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class junit.framework.TestCase
      • setName

        public void setName​(java.lang.String name)
        Overrides:
        setName in class junit.framework.TestCase
      • getName

        public java.lang.String getName()
        Overrides:
        getName in class junit.framework.TestCase
      • createDefaultEnvironment

        public TestEnvironment createDefaultEnvironment()
      • runTest

        protected final void runTest()
                              throws java.lang.Throwable
        Overrides:
        runTest in class junit.framework.TestCase
        Throws:
        java.lang.Throwable
      • skipKnownBreakTests

        private static boolean skipKnownBreakTests()
      • doRunTest

        protected void doRunTest​(java.lang.String name)
                          throws java.lang.Throwable
        Throws:
        java.lang.Throwable
      • getType

        public IType getType()
      • getTypeName

        public java.lang.String getTypeName()
      • getClassName

        public java.lang.String getClassName()
      • getPackageName

        public java.lang.String getPackageName()
      • assertArrayEquals

        public static void assertArrayEquals​(java.lang.Object[] expected,
                                             java.lang.Object[] got)
      • assertArrayEquals

        public static void assertArrayEquals​(java.lang.String message,
                                             byte[] expected,
                                             byte[] actual)
        Compare two byte arrays, first the size then each byte.
        Parameters:
        expected -
        actual -
      • assertArrayEquals

        public static void assertArrayEquals​(java.lang.Object[] expected,
                                             java.lang.Object[] got,
                                             TestClass.EqualityTester tester)
        Verifies that all elements in the first array are present in the second array and match the elements in the first array. Uses EqualityUtil to determine equality and is order-insensitive.
        Parameters:
        expected - the expected result (reference)
        got - the obtained result (what to compare against the reference)
      • appendFoundStatus

        private static void appendFoundStatus​(java.lang.StringBuffer sb,
                                              java.lang.Object[] expected,
                                              boolean[] expectedFound)
      • makeFoundArray

        private static boolean[] makeFoundArray​(int length)
      • allTrue

        private static boolean allTrue​(boolean[] booleans)
      • assertArrayEquals

        public static void assertArrayEquals​(java.lang.String message,
                                             java.lang.Object[] o1,
                                             java.lang.Object[] o2)
      • assertSetsEqual

        public static void assertSetsEqual​(java.util.Set o1,
                                           java.util.Set o2)
      • assertCollectionEquals

        public static void assertCollectionEquals​(java.util.Collection o1,
                                                  java.util.Collection o2)
      • assertListEquals

        public static void assertListEquals​(java.util.List o1,
                                            java.util.List o2)
      • assertIterableEquals

        public static void assertIterableEquals​(java.lang.Iterable o1,
                                                java.lang.Iterable o2)
      • assertCollectionEquals

        public static void assertCollectionEquals​(java.util.Collection o1,
                                                  java.util.Collection o2,
                                                  java.util.Comparator c)
      • assertListEquals

        public static void assertListEquals​(java.util.List o1,
                                            java.util.List o2,
                                            java.util.Comparator c)
      • assertIterableEquals

        public static void assertIterableEquals​(java.lang.Iterable o1,
                                                java.lang.Iterable o2,
                                                java.util.Comparator c)
      • assertIterableEqualsIgnoreOrder

        public static void assertIterableEqualsIgnoreOrder​(java.lang.Iterable i1,
                                                           java.lang.Iterable i2)
      • assertZero

        public static void assertZero​(int i)
      • assertZero

        public static void assertZero​(long i)
      • assertMatchRegex

        public static void assertMatchRegex​(java.lang.String message,
                                            java.lang.String pattern,
                                            java.lang.String result)
      • makeHistogram

        private static java.util.Map makeHistogram​(java.lang.Iterable o1)
      • assertIterableEquals

        private static void assertIterableEquals​(java.lang.Iterable i1,
                                                 java.lang.Iterable i2,
                                                 java.lang.String s)
      • assertIterableEquals

        private static void assertIterableEquals​(java.lang.Iterable i1,
                                                 java.lang.Iterable i2,
                                                 java.util.Comparator c,
                                                 java.lang.String s)
      • makeList

        private static java.util.List makeList​(java.lang.Iterable o1)
      • getTotalNumTestMethods

        public int getTotalNumTestMethods()
      • getMetadata

        public java.util.List<TestMetadata> getMetadata()
        Description copied from interface: ITestWithMetadata
        Returns any applicable metadata for the tests in this class.
        Specified by:
        getMetadata in interface ITestWithMetadata
        Returns:
        A list of @link{gw.test.ITestMetadata} objects, one for each test method providing metadata.
      • addMetadata

        protected void addMetadata​(java.util.Collection<TestMetadata> metadata)
      • createMethodMetadata

        public java.util.Collection<TestMetadata> createMethodMetadata​(java.lang.String method)
      • createClassMetadata

        public java.util.Collection<TestMetadata> createClassMetadata()
      • isKnownBreakQualifier

        private boolean isKnownBreakQualifier​(IAnnotationInfo ai)
      • isMetaAnnotationInfo

        protected boolean isMetaAnnotationInfo​(IAnnotationInfo ai)
      • createMetadata

        protected java.util.Collection<TestMetadata> createMetadata​(java.lang.annotation.Annotation[] annotations)
      • isKnownBreakQualifier

        private boolean isKnownBreakQualifier​(java.lang.annotation.Annotation a)
      • isMetaAnnotation

        protected boolean isMetaAnnotation​(java.lang.annotation.Annotation ai)
      • initMetadata

        public void initMetadata​(java.lang.String method)
      • assertCausesException

        public static void assertCausesException​(java.lang.Runnable r,
                                                 java.lang.Class<? extends java.lang.Throwable> c)
      • createTestClass

        public static TestClass createTestClass​(IType testType)
      • _suite

        public static <T extends TestClass> junit.framework.Test _suite​(java.lang.Class<T> clazz)