@Test public void require_that_multiple_packages_with_same_parameters_is_parsed_correctly() { List<Export> exports = ExportPackageParser.parseExports("exported.package1;exported.package2;version=\"1.2.3.sample\""); assertThat(exports.size(), is(1)); Export export = exports.get(0); assertThat(export.getPackageNames(), contains("exported.package1", "exported.package2")); assertThat(export.getParameters(), contains(parameterMatching(versionParameter))); }
public static List<ExportPackages.Export> parseExports(String exportAttribute) { ParsingContext p = new ParsingContext(exportAttribute.trim()); List<ExportPackages.Export> exports = parseExportPackage(p); if (exports.isEmpty()) { p.fail("Expected a list of exports"); } else if (p.atEnd() == false) { p.fail("Exports not fully processed"); } return exports; }
ExportPackageParser { public static List<ExportPackages.Export> parseExports(String exportAttribute) { ParsingContext p = new ParsingContext(exportAttribute.trim()); List<ExportPackages.Export> exports = parseExportPackage(p); if (exports.isEmpty()) { p.fail("Expected a list of exports"); } else if (p.atEnd() == false) { p.fail("Exports not fully processed"); } return exports; } }
ExportPackageParser { public static List<ExportPackages.Export> parseExports(String exportAttribute) { ParsingContext p = new ParsingContext(exportAttribute.trim()); List<ExportPackages.Export> exports = parseExportPackage(p); if (exports.isEmpty()) { p.fail("Expected a list of exports"); } else if (p.atEnd() == false) { p.fail("Exports not fully processed"); } return exports; }  }
ExportPackageParser { public static List<ExportPackages.Export> parseExports(String exportAttribute) { ParsingContext p = new ParsingContext(exportAttribute.trim()); List<ExportPackages.Export> exports = parseExportPackage(p); if (exports.isEmpty()) { p.fail("Expected a list of exports"); } else if (p.atEnd() == false) { p.fail("Exports not fully processed"); } return exports; }  static List<ExportPackages.Export> parseExports(String exportAttribute); }
ExportPackageParser { public static List<ExportPackages.Export> parseExports(String exportAttribute) { ParsingContext p = new ParsingContext(exportAttribute.trim()); List<ExportPackages.Export> exports = parseExportPackage(p); if (exports.isEmpty()) { p.fail("Expected a list of exports"); } else if (p.atEnd() == false) { p.fail("Exports not fully processed"); } return exports; }  static List<ExportPackages.Export> parseExports(String exportAttribute);  }