ContractDeclaredBehaviorTransformer extends AbstractContractClassTransformer { @Override public void transform(ContractInfo contractInfo, CtClass currentContractClass) throws Exception { for (CtBehavior contractBehavior : currentContractClass.getDeclaredBehaviors()) { if (LOGGER.isTraceEnabled()) { LOGGER.trace("transforming behavior " + contractBehavior.getLongName()); } transform(contractInfo, contractBehavior); } }  @Override void transform(ContractInfo contractInfo, CtClass currentContractClass); abstract void transform(ContractInfo contractInfo, CtBehavior contractBehavior);  }
@Test public void testTransform() throws Exception { DummyContractDeclaredBehaviorTransformer transformer = new DummyContractDeclaredBehaviorTransformer(); CtClass contractClass = ClassPool.getDefault().get(ContractClass.class.getName()); transformer.transform(null, contractClass); assertThat(transformer.getCalledBehaviors(), containsInAnyOrder(contractClass .getDeclaredConstructor(new CtClass[0]), contractClass.getDeclaredMethod("methodOne"), contractClass .getDeclaredMethod("methodTwo"))); }