Method[] expected_methods = expected.getMethods();
Method[] obtained_methods = obtained.getMethods();
int i=0;
int k=0;
for(i=0;i< expected_methods.length;i++) {
Method expectedm = expected_methods[i];
Method obtainedm;
for(k=i;k < obtained_methods.length; k++) {
obtainedm = obtained_methods[k];
if (obtainedm.getSignature().equals(expectedm.getSignature())) {
obtained_methods[k]=obtained_methods[i];
obtained_methods[i]=null;
//System.out.println(expectedm.getCode().toString(true));
assertEquals("MethodCode is different", expectedm.getCode().toString(false), obtainedm.getCode().toString(false));
break;
}
}
if (k==obtained_methods.length) {
fail("Method "+expectedm.getSignature()+ " not found in obtained");