JavaPropertiesCommentAnalyser extends CommentAnalyser { @Override public String getContents(String comment) { if (comment.startsWith("#") || comment.startsWith("!")) { return comment.substring(1, comment.length()); } else { throw new IllegalArgumentException(); } }  @Override boolean isBlank(String line); @Override String getContents(String comment);  }
@Test public void content() { assertThat(analyser.getContents("# comment")).isEqualTo(" comment"); assertThat(analyser.getContents("! comment")).isEqualTo(" comment"); assertThat(analyser.getContents("#comment")).isEqualTo("comment"); assertThat(analyser.getContents("!comment")).isEqualTo("comment"); }
@Test(expected = IllegalArgumentException.class) public void unknown_type_of_comments() { analyser.getContents(""); }