@Test public void testHandWrittenClassNotFound() { Mockito.when(targetPath.exists(Mockito.any(Path.class))).thenReturn(false); ASTCDDefinition ast = this.topDecorator.decorate(this.topCD).getCDDefinition(); assertEquals(1, ast.getCDClassList().size()); ASTCDClass cdClass = ast.getCDClassList().get(0); assertEquals("C", cdClass.getName()); assertDeepEquals(PUBLIC, cdClass.getModifier()); assertEquals(1, cdClass.getCDConstructorList().size()); ASTCDConstructor constructor = cdClass.getCDConstructorList().get(0); assertEquals("C", constructor.getName()); assertDeepEquals(PROTECTED, constructor.getModifier()); assertEquals(1, ast.getCDInterfaceList().size()); ASTCDInterface cdInterface = ast.getCDInterfaceList().get(0); assertEquals("I", cdInterface.getName()); assertDeepEquals(PUBLIC, cdInterface.getModifier()); assertEquals(1, ast.getCDEnumList().size()); ASTCDEnum cdEnum = ast.getCDEnumList().get(0); assertEquals("E", cdEnum.getName()); assertDeepEquals(PUBLIC, cdEnum.getModifier()); }
@Override public ASTCDCompilationUnit decorate(final ASTCDCompilationUnit originalCD) { ASTCDCompilationUnit topCD = originalCD; topCD.getCDDefinition().getCDClassList().stream() .filter(cdClass -> existsHandwrittenClass(hwPath, constructQualifiedName(topCD.getPackageList(), cdClass.getName()))) .forEach(this::applyTopMechanism); topCD.getCDDefinition().getCDInterfaceList().stream() .filter(cdInterface -> existsHandwrittenClass(hwPath, constructQualifiedName(topCD.getPackageList(), cdInterface.getName()))) .forEach(this::applyTopMechanism); topCD.getCDDefinition().getCDEnumList().stream() .filter(cdEnum -> existsHandwrittenClass(hwPath, constructQualifiedName(topCD.getPackageList(), cdEnum.getName()))) .forEach(this::applyTopMechanism); return topCD; }
TopDecorator extends AbstractCreator<ASTCDCompilationUnit,ASTCDCompilationUnit> { @Override public ASTCDCompilationUnit decorate(final ASTCDCompilationUnit originalCD) { ASTCDCompilationUnit topCD = originalCD; topCD.getCDDefinition().getCDClassList().stream() .filter(cdClass -> existsHandwrittenClass(hwPath, constructQualifiedName(topCD.getPackageList(), cdClass.getName()))) .forEach(this::applyTopMechanism); topCD.getCDDefinition().getCDInterfaceList().stream() .filter(cdInterface -> existsHandwrittenClass(hwPath, constructQualifiedName(topCD.getPackageList(), cdInterface.getName()))) .forEach(this::applyTopMechanism); topCD.getCDDefinition().getCDEnumList().stream() .filter(cdEnum -> existsHandwrittenClass(hwPath, constructQualifiedName(topCD.getPackageList(), cdEnum.getName()))) .forEach(this::applyTopMechanism); return topCD; } }
TopDecorator extends AbstractCreator<ASTCDCompilationUnit,ASTCDCompilationUnit> { @Override public ASTCDCompilationUnit decorate(final ASTCDCompilationUnit originalCD) { ASTCDCompilationUnit topCD = originalCD; topCD.getCDDefinition().getCDClassList().stream() .filter(cdClass -> existsHandwrittenClass(hwPath, constructQualifiedName(topCD.getPackageList(), cdClass.getName()))) .forEach(this::applyTopMechanism); topCD.getCDDefinition().getCDInterfaceList().stream() .filter(cdInterface -> existsHandwrittenClass(hwPath, constructQualifiedName(topCD.getPackageList(), cdInterface.getName()))) .forEach(this::applyTopMechanism); topCD.getCDDefinition().getCDEnumList().stream() .filter(cdEnum -> existsHandwrittenClass(hwPath, constructQualifiedName(topCD.getPackageList(), cdEnum.getName()))) .forEach(this::applyTopMechanism); return topCD; } TopDecorator(IterablePath hwPath); }
TopDecorator extends AbstractCreator<ASTCDCompilationUnit,ASTCDCompilationUnit> { @Override public ASTCDCompilationUnit decorate(final ASTCDCompilationUnit originalCD) { ASTCDCompilationUnit topCD = originalCD; topCD.getCDDefinition().getCDClassList().stream() .filter(cdClass -> existsHandwrittenClass(hwPath, constructQualifiedName(topCD.getPackageList(), cdClass.getName()))) .forEach(this::applyTopMechanism); topCD.getCDDefinition().getCDInterfaceList().stream() .filter(cdInterface -> existsHandwrittenClass(hwPath, constructQualifiedName(topCD.getPackageList(), cdInterface.getName()))) .forEach(this::applyTopMechanism); topCD.getCDDefinition().getCDEnumList().stream() .filter(cdEnum -> existsHandwrittenClass(hwPath, constructQualifiedName(topCD.getPackageList(), cdEnum.getName()))) .forEach(this::applyTopMechanism); return topCD; } TopDecorator(IterablePath hwPath); @Override ASTCDCompilationUnit decorate(final ASTCDCompilationUnit originalCD); }
TopDecorator extends AbstractCreator<ASTCDCompilationUnit,ASTCDCompilationUnit> { @Override public ASTCDCompilationUnit decorate(final ASTCDCompilationUnit originalCD) { ASTCDCompilationUnit topCD = originalCD; topCD.getCDDefinition().getCDClassList().stream() .filter(cdClass -> existsHandwrittenClass(hwPath, constructQualifiedName(topCD.getPackageList(), cdClass.getName()))) .forEach(this::applyTopMechanism); topCD.getCDDefinition().getCDInterfaceList().stream() .filter(cdInterface -> existsHandwrittenClass(hwPath, constructQualifiedName(topCD.getPackageList(), cdInterface.getName()))) .forEach(this::applyTopMechanism); topCD.getCDDefinition().getCDEnumList().stream() .filter(cdEnum -> existsHandwrittenClass(hwPath, constructQualifiedName(topCD.getPackageList(), cdEnum.getName()))) .forEach(this::applyTopMechanism); return topCD; } TopDecorator(IterablePath hwPath); @Override ASTCDCompilationUnit decorate(final ASTCDCompilationUnit originalCD); static final String TOP_SUFFIX; }