1
0
mirror of https://github.com/google/nomulus synced 2025-12-23 06:15:42 +00:00

Make ignoreLinesStartingWith varargs (#2691)

It still is a list, because we String::startsWith does not benefit from
the target being in a set.
This commit is contained in:
Lai Jiang
2025-02-26 12:12:24 -05:00
committed by GitHub
parent 0f3b62d5ce
commit 9fe64bf9ec
2 changed files with 4 additions and 5 deletions

View File

@@ -35,7 +35,6 @@ import com.google.common.truth.SimpleSubjectBuilder;
import com.google.common.truth.Subject;
import java.io.IOException;
import java.net.URL;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Comparator;
import java.util.List;
@@ -64,7 +63,7 @@ public class TextDiffSubject extends Subject {
private final ImmutableList<String> actual;
private DiffFormat diffFormat = DiffFormat.SIDE_BY_SIDE_MARKDOWN;
private List<String> comments = new ArrayList<>();
private ImmutableList<String> comments = ImmutableList.of();
protected TextDiffSubject(FailureMetadata metadata, List<String> actual) {
super(metadata, actual);
@@ -86,8 +85,8 @@ public class TextDiffSubject extends Subject {
}
/** If set, ignore lines that start with the given string. */
public TextDiffSubject ignoringLinesThatStartWith(String comment) {
comments.add(comment);
public TextDiffSubject ignoringLinesStartingWith(String... comments) {
this.comments = ImmutableList.copyOf(comments);
return this;
}