org.sourceforge.jemm.weaver.transformation.field
Class FieldClassifierTest

java.lang.Object
  extended by org.sourceforge.jemm.weaver.DefaultTestCase
      extended by org.sourceforge.jemm.weaver.transformation.field.FieldClassifierTest

public class FieldClassifierTest
extends DefaultTestCase

Test cases for FieldClassifier.

Author:
Paul Keeble

Constructor Summary
FieldClassifierTest()
           
 
Method Summary
 void isArray()
          Test the isArray method correctly identifies a field as an array.
 void isWrapper()
          Tests the mapping of all the Primitive types
 void setUp()
          Pre-test setup method.
 void tearDown()
          Post test tear down.
 void testPrimitive()
          Test that the base type class is correctly classified.
 void testShadowObject()
          Test that the shadow variable is mapped to the correct classifcation.
 void testString()
          Test that the String class is correctly classified as immutable.
 void testSupportedDirectChild()
          Tests that the ContainedDummy class is correctly classified as supported.
 void testSupportedDirectUnconvertedChild()
           
 void testSupportedIndirectChild()
          Tests that the ChildDummy class is correctly classified as supported.
 void testUnsupported()
          Tests that the EmptyDummy class is correctly classified as unsupported.
 void typeTest(java.lang.Class<?> clazz, org.sourceforge.jemm.weaver.transformation.field.FieldClassifier.Classification mappedTo)
           
 void typeTest(java.lang.Class<?> clazz, org.sourceforge.jemm.weaver.transformation.field.FieldClassifier.Classification mappedTo, java.lang.String fieldName)
           
 void typeTest(javassist.CtClass clazz, org.sourceforge.jemm.weaver.transformation.field.FieldClassifier.Classification mappedTo, java.lang.String fieldName)
          Check that the given field on the class has been correctly classified.
 void typeTest(java.lang.String className, org.sourceforge.jemm.weaver.transformation.field.FieldClassifier.Classification mappedTo, java.lang.String fieldName)
           
 void typeTestArray(java.lang.Class<?> clazz, org.sourceforge.jemm.weaver.transformation.field.FieldClassifier.Classification mappedTo)
           
 void typeTestArray(java.lang.Class<?> clazz, org.sourceforge.jemm.weaver.transformation.field.FieldClassifier.Classification mappedTo, java.lang.String fieldName)
           
 void typeTestCombined(java.lang.Class<?> clazz, org.sourceforge.jemm.weaver.transformation.field.FieldClassifier.Classification mappedTo)
           
 
Methods inherited from class org.sourceforge.jemm.weaver.DefaultTestCase
checkedExceptionThrowingConstructorClass, childDummyClass, cleanupClassPool, containedDummyClass, emptyClass, exceptionThrowingConstructorClass, hackClassPath, initialiseClass, initialiseSession, loadClass, methodClass, methodJEMMObjectAccess, referenceArrayClass, referenceClass, synchronizedBlockDummyClass, unconvertedContainedDummyClass, unloadClass, unsupportedDummyClass
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FieldClassifierTest

public FieldClassifierTest()
Method Detail

setUp

public void setUp()
           throws java.lang.Exception
Pre-test setup method.

Throws:
java.lang.Exception - On error.

tearDown

public void tearDown()
Post test tear down.


typeTest

public void typeTest(javassist.CtClass clazz,
                     org.sourceforge.jemm.weaver.transformation.field.FieldClassifier.Classification mappedTo,
                     java.lang.String fieldName)
              throws java.lang.Exception
Check that the given field on the class has been correctly classified.

Parameters:
clazz - The target class.
mappedTo - The expected classification.
fieldName - The target field.
Throws:
java.lang.Exception - On error.

typeTest

public void typeTest(java.lang.Class<?> clazz,
                     org.sourceforge.jemm.weaver.transformation.field.FieldClassifier.Classification mappedTo,
                     java.lang.String fieldName)
              throws java.lang.Exception
Throws:
java.lang.Exception

typeTestArray

public void typeTestArray(java.lang.Class<?> clazz,
                          org.sourceforge.jemm.weaver.transformation.field.FieldClassifier.Classification mappedTo,
                          java.lang.String fieldName)
                   throws java.lang.Exception
Throws:
java.lang.Exception

typeTest

public void typeTest(java.lang.String className,
                     org.sourceforge.jemm.weaver.transformation.field.FieldClassifier.Classification mappedTo,
                     java.lang.String fieldName)
              throws java.lang.Exception
Throws:
java.lang.Exception

typeTest

public void typeTest(java.lang.Class<?> clazz,
                     org.sourceforge.jemm.weaver.transformation.field.FieldClassifier.Classification mappedTo)
              throws java.lang.Exception
Throws:
java.lang.Exception

typeTestArray

public void typeTestArray(java.lang.Class<?> clazz,
                          org.sourceforge.jemm.weaver.transformation.field.FieldClassifier.Classification mappedTo)
                   throws java.lang.Exception
Throws:
java.lang.Exception

typeTestCombined

public void typeTestCombined(java.lang.Class<?> clazz,
                             org.sourceforge.jemm.weaver.transformation.field.FieldClassifier.Classification mappedTo)
                      throws java.lang.Exception
Throws:
java.lang.Exception

testShadowObject

public void testShadowObject()
                      throws java.lang.Exception
Test that the shadow variable is mapped to the correct classifcation.

Throws:
java.lang.Exception - On error.

testPrimitive

public void testPrimitive()
                   throws java.lang.Exception
Test that the base type class is correctly classified.

Throws:
java.lang.Exception - On error.

testString

public void testString()
                throws java.lang.Exception
Test that the String class is correctly classified as immutable.

Throws:
java.lang.Exception - On Error.

isWrapper

public void isWrapper()
               throws java.lang.Exception
Tests the mapping of all the Primitive types

Throws:
java.lang.Exception

testSupportedDirectChild

public void testSupportedDirectChild()
                              throws java.lang.Exception
Tests that the ContainedDummy class is correctly classified as supported.

Throws:
java.lang.Exception - On error.

testSupportedDirectUnconvertedChild

public void testSupportedDirectUnconvertedChild()
                                         throws java.lang.Exception
Throws:
java.lang.Exception

testSupportedIndirectChild

public void testSupportedIndirectChild()
                                throws java.lang.Exception
Tests that the ChildDummy class is correctly classified as supported.

Throws:
java.lang.Exception - On error.

testUnsupported

public void testUnsupported()
                     throws java.lang.Exception
Tests that the EmptyDummy class is correctly classified as unsupported.

Throws:
java.lang.Exception - On error.

isArray

public void isArray()
             throws java.lang.Exception
Test the isArray method correctly identifies a field as an array.

Throws:
java.lang.Exception - On error.


Copyright © 2009. All Rights Reserved.