CodeLine { public static long lineCount(List<String> lines) throws IOException { List<String> strings = linesWithoutBackslashStarComment(lines); return listWithoutDoubleSlashComments(strings).count(); }  static long lineCount(List<String> lines);  }
@Test public void it_should_have_correct_count_for_a_code_of_one_line() throws IOException { assertThat(CodeLine.lineCount(codeLines().add("public class Sample1 {}").build())).isEqualTo(1); }
@Test public void it_should_have_correct_count_for_a_code_of_one_line_with_one_double_slash_comment() throws IOException { assertThat(CodeLine.lineCount(codeLines().add(" .add("public class Sample2 {}").build())).isEqualTo(1); }
@Test public void it_should_have_correct_count_for_a_code_of_one_line_with_one_double_slash_after_whitespace_comment() throws IOException { assertThat(CodeLine.lineCount(codeLines() .add(" }
@Test public void it_should_have_correct_count_for_a_code_of_one_line_with_one_empty_line() throws IOException { assertThat(CodeLine.lineCount(codeLines().add("") .add("public class Sample4 {}") .build())).isEqualTo(1); }
@Test public void it_should_have_correct_count_for_a_code_with_slashes_on_separate_line() throws IOException { assertThat(CodeLine.lineCount(codeLines().add("") .add("public class sample5() {}").build())).isEqualTo(1); }
@Test public void it_should_have_correct_result_for_a_double_slash_inside_a_backslash_star() throws IOException { assertThat(CodeLine.lineCount(codeLines().add("").add("public class sample6() {}") .build())).isEqualTo(1); }
@Test public void it_should_have_correct_result_for_a_pathological_comment_ending() throws IOException { assertThat(CodeLine.lineCount(codeLines().add(" .add("") .add("public static void main() {}") .build())).isEqualTo(1); }
@Test public void it_should_have_correct_result_for_a_test_ending_with_comment() throws IOException { assertThat(CodeLine.lineCount(codeLines() .add("public static void main() {}") .build())).isEqualTo(1); }
@Test public void acceptance_test() throws IOException { assertThat(CodeLine.lineCount(codeLines().add(" .add("") .add("class sample {") .add(" public static final void main(String [] args) { .add(" .add("System.out.println('Hello/*');") .build())).isEqualTo(3); }