@Test public void testSimpleLineCountParser() throws Exception { LineCountData data = new LineCountParser( new File("src/test/resources/parsers/linecount/simple.xml"), Charsets.UTF_8) .getLineCountData(); assertThat(data.effectiveCommentLines()).containsOnly(3); assertThat(data.linesNumber()).isEqualTo(18); assertThat(data.linesOfCodeLines()).hasSize(15); assertThat(data.linesOfCodeLines()) .containsOnly(1, 4, 5, 6, 7, 8, 9, 10, 12, 13, 14, 15, 16, 17, 18); }
@Test public void testComplexLineCountParser() throws Exception { LineCountData data = new LineCountParser( new File("src/test/resources/parsers/linecount/complex.xml"), Charsets.UTF_8) .getLineCountData(); assertThat(data.effectiveCommentLines()).hasSize(12); assertThat(data.effectiveCommentLines()) .containsOnly(4, 5, 8, 9, 10, 21, 23, 24, 28, 29, 30, 33); assertThat(data.linesOfCodeLines()).hasSize(21); assertThat(data.linesOfCodeLines()) .containsOnly( 1, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 22, 25, 26, 27, 34, 35, 36, 37, 38, 39); assertThat(data.linesNumber()).isEqualTo(40); }