@Test public void testListingParserWarnings() throws Exception { final File listingFile = new File("target/unit/test_listing.out"); final String warning = "%CCL-W-44-CCL(1,15) SAMPLE_PROGRAM cannot be dropped - it does not exist"; FileUtils.deleteQuietly(listingFile); final List<String> output = new ArrayList<String>(); output.add("1) drop program blech go"); output.add(warning); output.add(""); output.add("end go"); FileUtils.writeLines(listingFile, output); final ListingParseResult parseResult = parser.parseListing(listingFile); assertThat(parseResult.getErrors()).isEmpty(); final Collection<? extends CclWarning> warnings = parseResult.getWarnings(); assertThat(warnings).hasSize(1); final Iterator<? extends CclWarning> it = warnings.iterator(); assertThat(it.next().getMessage()).isEqualTo(warning); }
public ListingParseResult parseListing(final File listing) throws IOException { if (listing == null) throw new NullPointerException("Listing cannot be null."); final EtmPoint point = PointFactory.getPoint(getClass(), "parseListing"); final Collection<CclError> errors = new ArrayList<CclError>(); final Collection<CclWarning> warnings = new ArrayList<CclWarning>(); try { for (final Iterator<String> it = readFile(listing).iterator(); it.hasNext();) { final String line = it.next(); if (!LINE_NUM_PATTERN.matcher(line).matches()) { if (line.startsWith("%CCL-E")) errors.add(new CclError(parseMessage(line, it))); else if (line.startsWith("%CCL-W")) warnings.add(new CclWarning(parseMessage(line, it))); } } } finally { point.collect(); } return new ListingParseResult(warnings, errors); }
ListingParser { public ListingParseResult parseListing(final File listing) throws IOException { if (listing == null) throw new NullPointerException("Listing cannot be null."); final EtmPoint point = PointFactory.getPoint(getClass(), "parseListing"); final Collection<CclError> errors = new ArrayList<CclError>(); final Collection<CclWarning> warnings = new ArrayList<CclWarning>(); try { for (final Iterator<String> it = readFile(listing).iterator(); it.hasNext();) { final String line = it.next(); if (!LINE_NUM_PATTERN.matcher(line).matches()) { if (line.startsWith("%CCL-E")) errors.add(new CclError(parseMessage(line, it))); else if (line.startsWith("%CCL-W")) warnings.add(new CclWarning(parseMessage(line, it))); } } } finally { point.collect(); } return new ListingParseResult(warnings, errors); } }
ListingParser { public ListingParseResult parseListing(final File listing) throws IOException { if (listing == null) throw new NullPointerException("Listing cannot be null."); final EtmPoint point = PointFactory.getPoint(getClass(), "parseListing"); final Collection<CclError> errors = new ArrayList<CclError>(); final Collection<CclWarning> warnings = new ArrayList<CclWarning>(); try { for (final Iterator<String> it = readFile(listing).iterator(); it.hasNext();) { final String line = it.next(); if (!LINE_NUM_PATTERN.matcher(line).matches()) { if (line.startsWith("%CCL-E")) errors.add(new CclError(parseMessage(line, it))); else if (line.startsWith("%CCL-W")) warnings.add(new CclWarning(parseMessage(line, it))); } } } finally { point.collect(); } return new ListingParseResult(warnings, errors); }  }
ListingParser { public ListingParseResult parseListing(final File listing) throws IOException { if (listing == null) throw new NullPointerException("Listing cannot be null."); final EtmPoint point = PointFactory.getPoint(getClass(), "parseListing"); final Collection<CclError> errors = new ArrayList<CclError>(); final Collection<CclWarning> warnings = new ArrayList<CclWarning>(); try { for (final Iterator<String> it = readFile(listing).iterator(); it.hasNext();) { final String line = it.next(); if (!LINE_NUM_PATTERN.matcher(line).matches()) { if (line.startsWith("%CCL-E")) errors.add(new CclError(parseMessage(line, it))); else if (line.startsWith("%CCL-W")) warnings.add(new CclWarning(parseMessage(line, it))); } } } finally { point.collect(); } return new ListingParseResult(warnings, errors); }  static ListingParser getInstance(); ListingParseResult parseListing(final File listing); }
ListingParser { public ListingParseResult parseListing(final File listing) throws IOException { if (listing == null) throw new NullPointerException("Listing cannot be null."); final EtmPoint point = PointFactory.getPoint(getClass(), "parseListing"); final Collection<CclError> errors = new ArrayList<CclError>(); final Collection<CclWarning> warnings = new ArrayList<CclWarning>(); try { for (final Iterator<String> it = readFile(listing).iterator(); it.hasNext();) { final String line = it.next(); if (!LINE_NUM_PATTERN.matcher(line).matches()) { if (line.startsWith("%CCL-E")) errors.add(new CclError(parseMessage(line, it))); else if (line.startsWith("%CCL-W")) warnings.add(new CclWarning(parseMessage(line, it))); } } } finally { point.collect(); } return new ListingParseResult(warnings, errors); }  static ListingParser getInstance(); ListingParseResult parseListing(final File listing);  }