@Test public void testEmptyMethodProcessor() throws Exception { final String[] args = { "-i", "src/test/resources/src/DocTest.java", "-o", "target/spooned/" }; final Launcher launcher = new Launcher(); launcher.setArgs(args); launcher.run(); final Factory factory = launcher.getFactory(); final ProcessingManager processingManager = new QueueProcessingManager(factory); final EmptyMethodBodyProcessor processor = new EmptyMethodBodyProcessor(); processingManager.addProcessor(processor); processingManager.process(factory.Class().getAll()); assertThat(processor.emptyMethods.size(), is(4)); }
public void process(CtMethod<?> element) { if (element.getParent(CtClass.class) != null && !element.getModifiers().contains(ModifierKind.ABSTRACT) && element.getBody().getStatements().isEmpty()) { emptyMethods.add(element); } }
EmptyMethodBodyProcessor extends AbstractProcessor<CtMethod<?>> { public void process(CtMethod<?> element) { if (element.getParent(CtClass.class) != null && !element.getModifiers().contains(ModifierKind.ABSTRACT) && element.getBody().getStatements().isEmpty()) { emptyMethods.add(element); } } }
EmptyMethodBodyProcessor extends AbstractProcessor<CtMethod<?>> { public void process(CtMethod<?> element) { if (element.getParent(CtClass.class) != null && !element.getModifiers().contains(ModifierKind.ABSTRACT) && element.getBody().getStatements().isEmpty()) { emptyMethods.add(element); } }  }
EmptyMethodBodyProcessor extends AbstractProcessor<CtMethod<?>> { public void process(CtMethod<?> element) { if (element.getParent(CtClass.class) != null && !element.getModifiers().contains(ModifierKind.ABSTRACT) && element.getBody().getStatements().isEmpty()) { emptyMethods.add(element); } }  void process(CtMethod<?> element); }
EmptyMethodBodyProcessor extends AbstractProcessor<CtMethod<?>> { public void process(CtMethod<?> element) { if (element.getParent(CtClass.class) != null && !element.getModifiers().contains(ModifierKind.ABSTRACT) && element.getBody().getStatements().isEmpty()) { emptyMethods.add(element); } }  void process(CtMethod<?> element); final List<CtMethod> emptyMethods; }