com.ashridgetech.jamda.test
Class BaseTest

java.lang.Object
  |
  +--junit.framework.Assert
        |
        +--junit.framework.TestCase
              |
              +--com.ashridgetech.jamda.test.BaseTest
All Implemented Interfaces:
junit.framework.Test
Direct Known Subclasses:
ClassGeneratorTest, ClassWriterTest, LoadingTest, TransformerTest, UmlClassGeneratorTest, UpdateTest, UtilTest, ValueObjectTest

public class BaseTest
extends junit.framework.TestCase

Common facilities for tests on the Jamda classes.


Field Summary
protected  java.util.List checkTextIgnorePrefixes
           
protected  ClassWriter classWriter
           
static java.lang.String MAGICDRAW_STYLESHEET_LOCATION
           
protected static java.lang.String[] NO_NAMES
           
protected static Type[] NO_TYPES
           
protected static java.lang.String projectRoot
           
protected  java.io.StringWriter stringWriter
           
protected static java.lang.String testFile
           
 
Constructor Summary
BaseTest(java.lang.String name)
          Standard constructor required by subclasses of TestCase
 
Method Summary
protected static void assertContains(java.util.Collection c, java.lang.Object o)
          Test that c contains an object equal to o.
protected static void assertContainsAsString(java.util.Collection c, java.lang.String s)
          Test that c contains an object whose toString method gives a value equal to s.
protected static void assertContainsOnly(java.util.Collection c, java.lang.Object o)
          Test that c contains an object equal to o and nothing else.
protected static void assertContainsOnly(java.util.Collection c, java.lang.Object o1, java.lang.Object o2)
          Test that c contains objects equal to o1 and o2 and nothing else.
protected static void assertContainsOnly(java.util.Collection c, java.lang.Object o1, java.lang.Object o2, java.lang.Object o3)
          Test that c contains objects equal to o1, o2 and o3 and nothing else.
protected static void assertContainsOnly(java.util.Collection c, java.lang.Object o1, java.lang.Object o2, java.lang.Object o3, java.lang.Object o4)
          Test that c contains objects equal to o1, o2, o4 and o4 and nothing else.
protected static void assertEmpty(java.util.Collection c)
          Test that c is empty
protected static void assertNotContainsAsString(java.util.Collection c, java.lang.String s)
          Test that c does not contain an object whose toString method gives a value equal to s.
static void checkAssocEnd(java.util.Collection assocEnds, java.lang.String name, java.lang.String otherEndName, Type type, StructuredType.Aggregation aggregation, boolean isChangeable, boolean isNavigable, int lower, int upper, boolean isMultiple)
          Check properties of an Association.End
static void checkAttribute(Attribute attribute, java.lang.String name, Type type, StructuredType.Visibility visibility, boolean isStatic)
          Check properties of an Attribute
protected  void checkEquals(java.lang.String expected, java.lang.String actual)
          Check two Strings for equality, and dump characters if they differ.
protected  void checkEquals(java.lang.String message, java.lang.String expected, java.lang.String actual)
          Check two Strings for equality, and dump characters if they differ.
static void checkOperation(Operation operation, java.lang.String name, StructuredType.Visibility visibility, Type returnType, boolean isStatic, boolean isQuery, boolean isAbstract, java.lang.String[] paramNames, Type[] paramTypes)
          Check properties of an Operation
static void checkProperty(Property prop, java.lang.String name, Type type, StructuredType.Aggregation aggregation, boolean isReadable, boolean isWritable, boolean isMultiple, boolean isOid)
          Check properties of an Property
protected  void checkText(java.lang.String expected)
          Check the current text written to classWriter's buffer.
protected  void checkText(java.lang.String expected, boolean dumpOnFail)
          Check the current text written to classWriter's buffer.
protected  boolean checkTextIgnore(java.lang.String expectedLine, java.lang.String actualLine)
           
protected static java.lang.String fullPathName(java.lang.String fileName)
           
protected static Model getModel()
           
protected  java.lang.String getText()
          Get the current text written to classWriter's buffer.
protected static Model loadModel(java.lang.String filename, boolean useXsltTransform)
           
protected static Model loadModel(java.lang.String filename, java.util.List factoryList, java.util.List stdElementClasses, boolean useXsltTransform)
           
protected static java.lang.String testFileName()
           
 
Methods inherited from class junit.framework.TestCase
countTestCases, createResult, getName, run, run, runBare, runTest, setName, setUp, tearDown, toString
 
Methods inherited from class junit.framework.Assert
assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, fail, fail
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

MAGICDRAW_STYLESHEET_LOCATION

public static final java.lang.String MAGICDRAW_STYLESHEET_LOCATION
See Also:
Constant Field Values

NO_NAMES

protected static final java.lang.String[] NO_NAMES

NO_TYPES

protected static final Type[] NO_TYPES

projectRoot

protected static java.lang.String projectRoot

testFile

protected static java.lang.String testFile

stringWriter

protected java.io.StringWriter stringWriter

classWriter

protected ClassWriter classWriter

checkTextIgnorePrefixes

protected java.util.List checkTextIgnorePrefixes
Constructor Detail

BaseTest

public BaseTest(java.lang.String name)
Standard constructor required by subclasses of TestCase

Parameters:
name - name
Method Detail

testFileName

protected static java.lang.String testFileName()

fullPathName

protected static java.lang.String fullPathName(java.lang.String fileName)

getModel

protected static Model getModel()

loadModel

protected static Model loadModel(java.lang.String filename,
                                 boolean useXsltTransform)

loadModel

protected static Model loadModel(java.lang.String filename,
                                 java.util.List factoryList,
                                 java.util.List stdElementClasses,
                                 boolean useXsltTransform)

checkProperty

public static void checkProperty(Property prop,
                                 java.lang.String name,
                                 Type type,
                                 StructuredType.Aggregation aggregation,
                                 boolean isReadable,
                                 boolean isWritable,
                                 boolean isMultiple,
                                 boolean isOid)
Check properties of an Property


checkAssocEnd

public static void checkAssocEnd(java.util.Collection assocEnds,
                                 java.lang.String name,
                                 java.lang.String otherEndName,
                                 Type type,
                                 StructuredType.Aggregation aggregation,
                                 boolean isChangeable,
                                 boolean isNavigable,
                                 int lower,
                                 int upper,
                                 boolean isMultiple)
Check properties of an Association.End


checkAttribute

public static void checkAttribute(Attribute attribute,
                                  java.lang.String name,
                                  Type type,
                                  StructuredType.Visibility visibility,
                                  boolean isStatic)
Check properties of an Attribute


checkOperation

public static void checkOperation(Operation operation,
                                  java.lang.String name,
                                  StructuredType.Visibility visibility,
                                  Type returnType,
                                  boolean isStatic,
                                  boolean isQuery,
                                  boolean isAbstract,
                                  java.lang.String[] paramNames,
                                  Type[] paramTypes)
Check properties of an Operation


assertEmpty

protected static void assertEmpty(java.util.Collection c)
Test that c is empty


assertContains

protected static void assertContains(java.util.Collection c,
                                     java.lang.Object o)
Test that c contains an object equal to o.


assertContainsOnly

protected static void assertContainsOnly(java.util.Collection c,
                                         java.lang.Object o)
Test that c contains an object equal to o and nothing else.


assertContainsOnly

protected static void assertContainsOnly(java.util.Collection c,
                                         java.lang.Object o1,
                                         java.lang.Object o2)
Test that c contains objects equal to o1 and o2 and nothing else.


assertContainsOnly

protected static void assertContainsOnly(java.util.Collection c,
                                         java.lang.Object o1,
                                         java.lang.Object o2,
                                         java.lang.Object o3)
Test that c contains objects equal to o1, o2 and o3 and nothing else.


assertContainsOnly

protected static void assertContainsOnly(java.util.Collection c,
                                         java.lang.Object o1,
                                         java.lang.Object o2,
                                         java.lang.Object o3,
                                         java.lang.Object o4)
Test that c contains objects equal to o1, o2, o4 and o4 and nothing else.


assertContainsAsString

protected static void assertContainsAsString(java.util.Collection c,
                                             java.lang.String s)
Test that c contains an object whose toString method gives a value equal to s.


assertNotContainsAsString

protected static void assertNotContainsAsString(java.util.Collection c,
                                                java.lang.String s)
Test that c does not contain an object whose toString method gives a value equal to s.


checkEquals

protected void checkEquals(java.lang.String message,
                           java.lang.String expected,
                           java.lang.String actual)
Check two Strings for equality, and dump characters if they differ.

Parameters:
expected - the expected text
actual - the actual text

checkEquals

protected void checkEquals(java.lang.String expected,
                           java.lang.String actual)
Check two Strings for equality, and dump characters if they differ.

Parameters:
expected - the expected text
actual - the actual text

getText

protected java.lang.String getText()
Get the current text written to classWriter's buffer.

Returns:
the text

checkText

protected void checkText(java.lang.String expected)
Check the current text written to classWriter's buffer.

Parameters:
expected - the expected text

checkText

protected void checkText(java.lang.String expected,
                         boolean dumpOnFail)
Check the current text written to classWriter's buffer.

Parameters:
expected - the expected text
dumpOnFail - if true, print the actual text if it fails

checkTextIgnore

protected boolean checkTextIgnore(java.lang.String expectedLine,
                                  java.lang.String actualLine)


Copyright © 2003 Ashridge Technologies Ltd. All Rights Reserved.