@Test(description = "Return modules list should be equivalence to the expected module list") public void testListSourceFilesAndPackages() { Names names = Names.getInstance(context); List<PackageID> expectedPackageIds = new ArrayList<>(); expectedPackageIds.add(new PackageID(names.fromString("abc"), names.fromString("fruits"), names.fromString("0.0.1")) ); Stream<PackageID> packageIDStream = directoryManager.listSourceFilesAndPackages(); Assert.assertTrue(packageIDStream.allMatch(expectedPackageIds::remove) && expectedPackageIds.isEmpty()); }
public Stream<PackageID> listSourceFilesAndPackages() { List<String> sourceFileNames = this.sourceDirectory.getSourceFileNames(); List<String> packageNames = this.sourceDirectory.getSourcePackageNames(); return Stream.concat(sourceFileNames.stream().map(this::getPackageID), packageNames.stream().map(this::getPackageID) ); }
SourceDirectoryManager implements Project { public Stream<PackageID> listSourceFilesAndPackages() { List<String> sourceFileNames = this.sourceDirectory.getSourceFileNames(); List<String> packageNames = this.sourceDirectory.getSourcePackageNames(); return Stream.concat(sourceFileNames.stream().map(this::getPackageID), packageNames.stream().map(this::getPackageID) ); } }
SourceDirectoryManager implements Project { public Stream<PackageID> listSourceFilesAndPackages() { List<String> sourceFileNames = this.sourceDirectory.getSourceFileNames(); List<String> packageNames = this.sourceDirectory.getSourcePackageNames(); return Stream.concat(sourceFileNames.stream().map(this::getPackageID), packageNames.stream().map(this::getPackageID) ); } private  SourceDirectoryManager(CompilerContext context); }
SourceDirectoryManager implements Project { public Stream<PackageID> listSourceFilesAndPackages() { List<String> sourceFileNames = this.sourceDirectory.getSourceFileNames(); List<String> packageNames = this.sourceDirectory.getSourcePackageNames(); return Stream.concat(sourceFileNames.stream().map(this::getPackageID), packageNames.stream().map(this::getPackageID) ); } private  SourceDirectoryManager(CompilerContext context); static SourceDirectoryManager getInstance(CompilerContext context); Stream<PackageID> listSourceFilesAndPackages(); PackageID getPackageID(String sourcePackage); SourceDirectory getSourceDirectory(); @Override boolean isModuleExists(PackageID moduleId); @Override Path getBaloPath(PackageID moduleId); }
SourceDirectoryManager implements Project { public Stream<PackageID> listSourceFilesAndPackages() { List<String> sourceFileNames = this.sourceDirectory.getSourceFileNames(); List<String> packageNames = this.sourceDirectory.getSourcePackageNames(); return Stream.concat(sourceFileNames.stream().map(this::getPackageID), packageNames.stream().map(this::getPackageID) ); } private  SourceDirectoryManager(CompilerContext context); static SourceDirectoryManager getInstance(CompilerContext context); Stream<PackageID> listSourceFilesAndPackages(); PackageID getPackageID(String sourcePackage); SourceDirectory getSourceDirectory(); @Override boolean isModuleExists(PackageID moduleId); @Override Path getBaloPath(PackageID moduleId);  }