ContractRegistry { public ContractInfo getContractInfoForTargetClass(CtClass targetClass) { return targetMap.get(targetClass); } ContractRegistry(); ContractInfo registerContract(CtClass targetClass, CtClass contractClass); ContractInfo getContractInfo(CtClass contractClass); boolean isContractClass(CtClass clazz); boolean hasRegisteredContract(CtClass targetClass); ContractInfo getContractInfoForTargetClass(CtClass targetClass); CtClass getExternalContract(CtClass type, CtClass affectedClass); ListOrderedSet<ContractInfo> getContractsForTypes(ListOrderedSet<CtClass> types, CtClass affectedClass); void registerExternalContract(XmlLocalConfiguration xmlLocalConfiguration); static final ContractRegistry INSTANCE; }
@Test public void testGetContractInfoForTargetClass() { assertNull(contractRegistry.getContractInfoForTargetClass(targetClass)); ContractInfo contractInfo = contractRegistry.registerContract(targetClass, contractClass); assertEquals(contractInfo, contractRegistry.getContractInfoForTargetClass(targetClass)); }