MetaInfReader { @VisibleForTesting static String stripComment(String line) { int index = line.indexOf('#'); if (index == -1) { return line; } else { return line.substring(0, index); } } private  MetaInfReader(); static Stream<Class<T>> readClasses(String fileName); static Stream<String> readLines(String fileName);  }
@Test public void testTrimComment() { String line = "# This is a comment"; String stripped = MetaInfReader.stripComment(line); assertEquals("Stripped comment should be empty", "", stripped); }
@Test public void testTrimCommentAfterLine() { String line = "What I want to keep # What I don't want to keep"; String stripped = MetaInfReader.stripComment(line); assertEquals("Unexpected stripped line", "What I want to keep ", stripped); }