### Question:
TabularMetadataGenerator { public TabularMetadata getMetadata(final URL dataUrl, final Boolean withHeaders) throws IOException { try (final CSVParser csvParser = parse(dataUrl, CHARACTER_ENCODING, format)) { final PeekingIterator<CSVRecord> parser = peekingIterator(csvParser.iterator()); final CSVRecord firstLine = parser.peek(); final boolean hasHeaders; if (withHeaders == null) { log.debug("Checking for the existence of headers."); for (final String field : firstLine) { headerStrategy.accept(field); } hasHeaders = headerStrategy.results(); headerStrategy.reset(); } else { hasHeaders = withHeaders; log.debug("Accepted information that headers is {}.", hasHeaders); } final List<String> headerNames; if (hasHeaders) { headerNames = newArrayList(firstLine); log.debug("Found headers: {}", headerNames); if (parser.hasNext()) parser.next(); } else { headerNames = emptyHeaders(firstLine.size()); log.debug("Found no headers."); } final TabularScanner scanner = new TabularScanner(parser, typeStrategy, rangeStrategy, enumStrategy); scanner.scan(scanLimit); final List<TypeDeterminingHeuristic<?>> typeStrategies = scanner.getTypeStrategies(); final List<RangeDeterminingHeuristic<?>> rangeStrategies = scanner.getRangeStrategies(); final List<EnumeratedValuesHeuristic<?>> enumStrategies = scanner.getEnumStrategies(); final List<DataType> columnTypes = typeStrategies.stream().map(Heuristic::results).collect(toList()); final List<Map<DataType, Range<?>>> minMaxes = rangeStrategies.stream().map(Heuristic::results) .collect(toList()); final List<Map<DataType, Set<String>>> enumValues = enumStrategies.stream().map(Heuristic::results) .collect(toList()); final List<Ratio> valuesSeen = typeStrategies.stream() .map(h -> new Ratio(h.valuesSeen() - h.parseableValuesSeen(), h.valuesSeen())).collect(toList()); return new TabularMetadata(headerNames, valuesSeen, columnTypes, minMaxes, enumValues); } catch (final NoSuchElementException e) { throw new EmptyDataFileException(dataUrl + " has no data in it!"); } }  TabularMetadata getMetadata(final URL dataUrl, final Boolean withHeaders); TabularMetadata getMetadata(final URL dataUrl); void setScanLimit(final Integer scanLimit); @Inject void setHeaderStrategy(final H strategy); @Inject void setFormat(final TabularFormat format); @Inject void setTypeStrategy(final TypeDeterminingHeuristic<?> strategy); @Inject void setRangeStrategy(final RangeDeterminingHeuristic<?> strategy); @Inject void setEnumStrategy(final EnumeratedValuesHeuristic<?> strategy);  }### Answer:
@Test(expected = EmptyDataFileException.class) public void testEmptyDataFile() throws IOException { final URL mockURL = mockURL("".getBytes()); final TabularMetadataGenerator testParser = newGenerator(mockRangeStrategy, mockEnumStrategy, mockTypeStrategy); testParser.getMetadata(mockURL); }