@Test public void testNullFile() throws Exception { NullPointerException e = assertThrows(NullPointerException.class, () -> { parser.parseListing(null); }); assertThat(e.getMessage()).isEqualTo("Listing cannot be null."); }
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);  }