### Question:
ObjectiveCAstScanner { public static SourceFile scanSingleFile(File file) { if (!file.isFile()) { throw new IllegalArgumentException("File '" + file + "' not found."); } AstScanner<ObjectiveCGrammar> scanner = create(ObjectiveCConfiguration.create(Charset.defaultCharset())); scanner.scanFile(file); Collection<SourceCode> sources = scanner.getIndex().search(new QueryByType(SourceFile.class)); if (sources.size() != 1) { throw new IllegalStateException("Only one SourceFile was expected whereas " + sources.size() + " has been returned."); } return (SourceFile) sources.iterator().next(); } private  ObjectiveCAstScanner(); static SourceFile scanSingleFile(File file); static AstScanner<ObjectiveCGrammar> create(ObjectiveCConfiguration conf);  }### Answer:
@Test public void lines() { SourceFile file = ObjectiveCAstScanner.scanSingleFile(new File("src/test/resources/objcSample.h")); Assert.assertThat(file.getInt(ObjectiveCMetric.LINES), Matchers.is(17)); }
@Test public void lines_of_code() { SourceFile file = ObjectiveCAstScanner.scanSingleFile(new File("src/test/resources/objcSample.h")); Assert.assertThat(file.getInt(ObjectiveCMetric.LINES_OF_CODE), Matchers.is(5)); }
@Test public void comments() { SourceFile file = ObjectiveCAstScanner.scanSingleFile(new File("src/test/resources/objcSample.h")); Assert.assertThat(file.getInt(ObjectiveCMetric.COMMENT_LINES), Matchers.is(4)); Assert.assertThat(file.getNoSonarTagLines(), Matchers.hasItem(10)); Assert.assertThat(file.getNoSonarTagLines().size(), Matchers.is(1)); }