ContractClassTransformer extends AbstractContractClassTransformer { @Override public void transform(ContractInfo contractInfo, CtClass contractClass) throws Exception { if (LOGGER.isDebugEnabled()) { LOGGER.debug("transforming contract " + contractClass.getName()); } for (AbstractContractClassTransformer transformer : transformers) { transformer.transform(contractInfo, contractClass); } insertUsageException(contractInfo, contractClass); addClassAnnotation(contractClass, ClassFilePool.INSTANCE.getClass(Transformed.class)); }  @Override void transform(ContractInfo contractInfo, CtClass contractClass);  }
@Test public void testTransform() throws Exception { ContractClassTransformer transformer = new ContractClassTransformer(); AbstractContractClassTransformer[] subTransformers = transformer.getTransformers(); for (int i = 0; i < subTransformers.length; i++) { subTransformers[i] = mock(subTransformers[i].getClass()); } CtClass targetClass = ClassPool.getDefault().get(TargetClass.class.getName()); CtClass contractClass = ClassPool.getDefault().get(ContractClass.class.getName()); contractClass.defrost(); ContractInfo contractInfo = ContractRegistry.INSTANCE.registerContract(targetClass, contractClass); transformer.transform(contractInfo, contractClass); for (AbstractContractClassTransformer subTransformer : transformer.getTransformers()) { verify(subTransformer).transform(contractInfo, contractClass); } }