@Test public void content() { assertThat(analyser.getContents(" assertThat(analyser.getContents("")).isEqualTo(" comment "); assertThat(analyser.getContents("<!-- comment")).isEqualTo(" comment"); assertThat(analyser.getContents("<!-- comment -->")).isEqualTo(" comment "); }
public String getContents(String comment) { if (comment.startsWith(" return comment.substring(2); } else if (comment.startsWith("/*")) { return comment.substring(2, comment.length() - 2); } else if (comment.startsWith("<!--")) { if (comment.endsWith("-->")) { return comment.substring(4, comment.length() - 3); } return comment.substring(4); } else { throw new IllegalArgumentException(); } }
JavaScriptCommentAnalyser { public String getContents(String comment) { if (comment.startsWith(" return comment.substring(2); } else if (comment.startsWith("/*")) { return comment.substring(2, comment.length() - 2); } else if (comment.startsWith("<!--")) { if (comment.endsWith("-->")) { return comment.substring(4, comment.length() - 3); } return comment.substring(4); } else { throw new IllegalArgumentException(); } } }
JavaScriptCommentAnalyser { public String getContents(String comment) { if (comment.startsWith(" return comment.substring(2); } else if (comment.startsWith("/*")) { return comment.substring(2, comment.length() - 2); } else if (comment.startsWith("<!--")) { if (comment.endsWith("-->")) { return comment.substring(4, comment.length() - 3); } return comment.substring(4); } else { throw new IllegalArgumentException(); } }  }
JavaScriptCommentAnalyser { public String getContents(String comment) { if (comment.startsWith(" return comment.substring(2); } else if (comment.startsWith("/*")) { return comment.substring(2, comment.length() - 2); } else if (comment.startsWith("<!--")) { if (comment.endsWith("-->")) { return comment.substring(4, comment.length() - 3); } return comment.substring(4); } else { throw new IllegalArgumentException(); } }  boolean isBlank(String line); String getContents(String comment); }
JavaScriptCommentAnalyser { public String getContents(String comment) { if (comment.startsWith(" return comment.substring(2); } else if (comment.startsWith("/*")) { return comment.substring(2, comment.length() - 2); } else if (comment.startsWith("<!--")) { if (comment.endsWith("-->")) { return comment.substring(4, comment.length() - 3); } return comment.substring(4); } else { throw new IllegalArgumentException(); } }  boolean isBlank(String line); String getContents(String comment);  }