@Test public void trimAll_A$String_StringIsEmpty() throws Exception { TrimCommentFilter target = new TrimCommentFilter(); String src = ""; String actual = target.trimAll(src); String expected = ""; assertThat(actual, is(equalTo(expected))); }
@Override public String trimAll(String src) { if (src == null) { return null; } String[] lines = src.split(RegExp.LF); StringBuilder sb = new StringBuilder(); for (String line : lines) { line = new TrimInsideOfStringFilter().trimAll(line).replaceFirst(" sb.append(line); } String withoutLineComments = sb.toString(); String withoutLineBreak = withoutLineComments.replaceAll("\r|\n", " "); String withoutComments = withoutLineBreak.replaceAll("/\\*.*?\\*/", StringValue.Empty); return withoutComments; }
TrimCommentFilter implements TrimFilter { @Override public String trimAll(String src) { if (src == null) { return null; } String[] lines = src.split(RegExp.LF); StringBuilder sb = new StringBuilder(); for (String line : lines) { line = new TrimInsideOfStringFilter().trimAll(line).replaceFirst(" sb.append(line); } String withoutLineComments = sb.toString(); String withoutLineBreak = withoutLineComments.replaceAll("\r|\n", " "); String withoutComments = withoutLineBreak.replaceAll("/\\*.*?\\*/", StringValue.Empty); return withoutComments; } }
TrimCommentFilter implements TrimFilter { @Override public String trimAll(String src) { if (src == null) { return null; } String[] lines = src.split(RegExp.LF); StringBuilder sb = new StringBuilder(); for (String line : lines) { line = new TrimInsideOfStringFilter().trimAll(line).replaceFirst(" sb.append(line); } String withoutLineComments = sb.toString(); String withoutLineBreak = withoutLineComments.replaceAll("\r|\n", " "); String withoutComments = withoutLineBreak.replaceAll("/\\*.*?\\*/", StringValue.Empty); return withoutComments; }  }
TrimCommentFilter implements TrimFilter { @Override public String trimAll(String src) { if (src == null) { return null; } String[] lines = src.split(RegExp.LF); StringBuilder sb = new StringBuilder(); for (String line : lines) { line = new TrimInsideOfStringFilter().trimAll(line).replaceFirst(" sb.append(line); } String withoutLineComments = sb.toString(); String withoutLineBreak = withoutLineComments.replaceAll("\r|\n", " "); String withoutComments = withoutLineBreak.replaceAll("/\\*.*?\\*/", StringValue.Empty); return withoutComments; }  @Override String trimAll(String src); }
TrimCommentFilter implements TrimFilter { @Override public String trimAll(String src) { if (src == null) { return null; } String[] lines = src.split(RegExp.LF); StringBuilder sb = new StringBuilder(); for (String line : lines) { line = new TrimInsideOfStringFilter().trimAll(line).replaceFirst(" sb.append(line); } String withoutLineComments = sb.toString(); String withoutLineBreak = withoutLineComments.replaceAll("\r|\n", " "); String withoutComments = withoutLineBreak.replaceAll("/\\*.*?\\*/", StringValue.Empty); return withoutComments; }  @Override String trimAll(String src);  }