// 1
String name = "someMethod";
Class[] types = new Class[] {int.class, Object.class};
InvocationConstraint ic = Delegation.YES;
InvocationConstraints constraints = new InvocationConstraints(
ic, null);
callConstructor(testCase, name, types, constraints);
// 2
if (testCase == case2arg) {
name = "*someMethod";
callConstructor(testCase, name, types, constraints);
name = "*5someMethod";
callConstructor(testCase, name, types, constraints);
}
// 3
if (testCase == case2arg) {
name = "someMethod*";
callConstructor(testCase, name, types, constraints);
}
// 4
if (testCase == case3arg) {
name = "someMethod";
Class[] storedTypes = new Class[types.length];
for (int j = 0; j < types.length; ++j) {
storedTypes[j] = types[j];
}
callConstructor(testCase, name, types, constraints);
if (storedTypes.length != types.length) {
throw new TestException(
"types array length was modified");
}
for (int j = 0; j < types.length; ++j) {
if (storedTypes[j] != types[j]) {
throw new TestException(
"types array was modified");
}
}
}
// 5
if (testCase == case3arg) {
name = "someMethod";
Class[] types2 = new Class[types.length];
for (int j = 0; j < types.length; ++j) {
types2[j] = types[j];
}
MethodDesc md1 =
callConstructor(testCase, name, types, constraints);
MethodDesc md2 =
callConstructor(testCase, name, types2, constraints);
if (!md1.equals(md2)) {
throw new TestException(
"MethodDesc objects should be equal");
}
types2[0] = long.class;
if (!md1.equals(md2)) {
throw new TestException(
"MethodDesc objects should be equal");
}
}
// 6
name = "someMethod";
InvocationConstraints emptyConstraints = new InvocationConstraints(
(InvocationConstraint) null, null);
MethodDesc md1 =
callConstructor(testCase, name, types, emptyConstraints);
MethodDesc md2 =
callConstructor(testCase, name, types, null);