AffectedBehaviorLocator { CtConstructor getAffectedConstructor(ContractInfo contractInfo, CtClass affectedClass, CtBehavior contractBehavior) throws NotFoundException { if (contractInfo.getTargetClass().isInterface()) { return null; } if (!affectedClass.equals(contractInfo.getTargetClass())) { return null; } CtConstructor affectedConstructor = getDeclaredConstructor(affectedClass, ClassAnalyzer .getConstructorParameterTypes(affectedClass, contractBehavior)); if (affectedConstructor == null) { LOGGER.warn("could not find a matching constructor in affected class " + affectedClass.getName() + " for constructor " + contractBehavior.getLongName()); return null; } return affectedConstructor; }  CtMethod getContractMethod(ContractInfo contract, CtMethod affectedMethod); CtBehavior getAffectedBehavior(ContractInfo contractInfo, CtClass affectedClass, CtBehavior contractBehavior);  }
@Test public void testGetAffectedConstructorForTargetInterface() throws Exception { assertNull(locator.getAffectedConstructor(contractInfoForTargetInterface, targetInterface, contractClass .getDeclaredConstructor(new CtClass[0]))); }
@Test public void testGetAffectedConstructor() throws Exception { assertEquals(targetClass.getDeclaredConstructor(new CtClass[] { CtClass.doubleType }), locator .getAffectedConstructor(contractInfo, targetClass, contractClass.getDeclaredMethod("constructor", new CtClass[] { CtClass.doubleType }))); }
@Test public void testGetAffectedConstructorForSynthetic() throws Exception { assertEquals(targetClass.getDeclaredConstructor(new CtClass[0]), locator.getAffectedConstructor(contractInfo, targetClass, contractClass.getDeclaredMethod("constructor", new CtClass[0]))); }
@Test public void testGetAffectedConstructorNotFound() throws Exception { assertNull(locator.getAffectedConstructor(contractInfo, targetClass, contractClass.getDeclaredMethod( "constructor", new CtClass[] { CtClass.intType }))); }