Package gw.test

Class TestClass

java.lang.Object
junit.framework.Assert
junit.framework.TestCase
gw.test.TestClass
All Implemented Interfaces:
ITestWithMetadata, junit.framework.Test
Direct Known Subclasses:
BaseRemoteTestClass, PL33465Test, TestClassWrapper.ExceptionTestClass, TestClassWrapper.InvalidTestClass

public abstract class TestClass extends junit.framework.TestCase implements ITestWithMetadata
  • Field Details

    • _pkgName

      private String _pkgName
    • _className

      private String _className
    • _executionManager

      private TestExecutionManager _executionManager
    • THREAD_LOCAL_EXECUTION_MANAGER

      private static final ThreadLocal<TestExecutionManager> THREAD_LOCAL_EXECUTION_MANAGER
    • _metadata

      private List<TestMetadata> _metadata
    • _doNotRun

      private boolean _doNotRun
    • _knownBreak

      private boolean _knownBreak
    • _numberOfInstancesCreatedByTypeName

      private static final Map<String,Integer> _numberOfInstancesCreatedByTypeName
    • _isGosuTest

      private boolean _isGosuTest
    • _skipKnownBreakTests

      private static Boolean _skipKnownBreakTests
  • Constructor Details

    • TestClass

      protected TestClass()
    • TestClass

      protected TestClass(String s)
    • TestClass

      protected TestClass(boolean shouldInit)
    • TestClass

      protected TestClass(String s, boolean shouldInit)
  • Method Details

    • isGosuTest

      public boolean isGosuTest()
    • setGosuTest

      public void setGosuTest(boolean gosuTest)
    • initInternalData

      protected void initInternalData()
    • getFullClassNameInternal

      protected String getFullClassNameInternal()
    • getNumberOfInstancesOfTestClassCreated

      public static Integer getNumberOfInstancesOfTestClassCreated(String typeName)
    • setUp

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

      public void setExecutionManager(TestExecutionManager executionManager)
    • tearDown

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

      public void beforeTestClass()
    • beforeTestMethod

      public void beforeTestMethod()
    • afterTestMethod

      public void afterTestMethod(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 Throwable
      Overrides:
      runBare in class junit.framework.TestCase
      Throws:
      Throwable
    • reallyRunBare

      public void reallyRunBare() throws Throwable
      Throws:
      Throwable
    • toString

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

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

      public String getName()
      Overrides:
      getName in class junit.framework.TestCase
    • getExecutionManager

      protected TestExecutionManager getExecutionManager()
    • getThreadLocalExecutionManager

      private TestExecutionManager getThreadLocalExecutionManager()
    • createDefaultEnvironment

      public TestEnvironment createDefaultEnvironment()
    • runTest

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

      private static boolean skipKnownBreakTests()
    • doRunTest

      protected void doRunTest(String name) throws Throwable
      Throws:
      Throwable
    • getType

      public IType getType()
    • getTypeName

      public String getTypeName()
    • getClassName

      public String getClassName()
    • getPackageName

      public String getPackageName()
    • assertArrayEquals

      public static void assertArrayEquals(Object[] expected, Object[] got)
    • assertArrayEquals

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

      public static void assertArrayEquals(Object[] expected, 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(StringBuffer sb, Object[] expected, boolean[] expectedFound)
    • makeFoundArray

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

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

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

      public static void assertSetsEqual(Set o1, Set o2)
    • assertCollectionEquals

      public static void assertCollectionEquals(Collection o1, Collection o2)
    • assertListEquals

      public static void assertListEquals(List o1, List o2)
    • assertIterableEquals

      public static void assertIterableEquals(Iterable o1, Iterable o2)
    • assertCollectionEquals

      public static void assertCollectionEquals(Collection o1, Collection o2, Comparator c)
    • assertListEquals

      public static void assertListEquals(List o1, List o2, Comparator c)
    • assertIterableEquals

      public static void assertIterableEquals(Iterable o1, Iterable o2, Comparator c)
    • assertIterableEqualsIgnoreOrder

      public static void assertIterableEqualsIgnoreOrder(Iterable i1, Iterable i2)
    • assertZero

      public static void assertZero(int i)
    • assertZero

      public static void assertZero(long i)
    • assertMatchRegex

      public static void assertMatchRegex(String message, String pattern, String result)
    • makeHistogram

      private static Map makeHistogram(Iterable o1)
    • assertIterableEquals

      private static void assertIterableEquals(Iterable i1, Iterable i2, String s)
    • assertIterableEquals

      private static void assertIterableEquals(Iterable i1, Iterable i2, Comparator c, String s)
    • makeList

      private static List makeList(Iterable o1)
    • getTotalNumTestMethods

      public int getTotalNumTestMethods()
    • getMetadata

      public 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(Collection<TestMetadata> metadata)
    • createMethodMetadata

      public Collection<TestMetadata> createMethodMetadata(String method)
    • createClassMetadata

      public Collection<TestMetadata> createClassMetadata()
    • createMetadata

      protected Collection<TestMetadata> createMetadata(List<IAnnotationInfo> annotationInfos)
    • isKnownBreakQualifier

      private boolean isKnownBreakQualifier(IAnnotationInfo ai)
    • isMetaAnnotationInfo

      protected boolean isMetaAnnotationInfo(IAnnotationInfo ai)
    • createMetadata

      protected Collection<TestMetadata> createMetadata(Annotation[] annotations)
    • isKnownBreakQualifier

      private boolean isKnownBreakQualifier(Annotation a)
    • isMetaAnnotation

      protected boolean isMetaAnnotation(Annotation ai)
    • initMetadata

      public void initMetadata(String method)
    • assertCausesException

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

      public static TestClass createTestClass(IType testType)
    • _suite

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