01: package org.andromda.translation.ocl.validation;
02:
03: import junit.framework.TestCase;
04:
05: /**
06: * Tests the OCLIntrospector
07: *
08: * @author Chad Brandon
09: */
10: public class OCLIntrospectorTest extends TestCase {
11:
12: private OCLIntrospectorTestObject object = new OCLIntrospectorTestObject();
13:
14: /**
15: * Constructor for OCLIntrospectorTest.
16: *
17: * @param name
18: */
19: public OCLIntrospectorTest(String name) {
20: super (name);
21: }
22:
23: /**
24: * Class under test for Object invoke(Object, String)
25: */
26: public void testInvokeObjectString() {
27: OCLIntrospector.invoke(object, "methodOne()");
28: String methodName = "methodTwo";
29: assertEquals(OCLIntrospector.invoke(object, "methodTwo()"),
30: methodName);
31: assertEquals(OCLIntrospectorTestObject.propertyOne,
32: OCLIntrospector.invoke(object, "propertyOne"));
33: assertEquals(OCLIntrospectorTestObject.propertyTwo,
34: OCLIntrospector.invoke(object, "propertyTwo"));
35: }
36:
37: /**
38: * Class under test for Object invoke(Object, String, Object[])
39: */
40: public void testInvokeObjectStringObjectArray() {
41: OCLIntrospector.invoke(object, "methodThree (argOne) ",
42: new Object[] { "argOne" });
43: String stringValue = "argOne";
44: assertEquals(OCLIntrospector.invoke(object,
45: "methodFour( argOne )", new Object[] { stringValue }),
46: stringValue);
47: Integer integerValue = new Integer(76);
48: assertEquals(OCLIntrospector.invoke(object,
49: "methodFive(argOne, argTwo)", new Object[] {
50: stringValue, integerValue }), integerValue);
51: }
52:
53: }
|