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:
@@ -35,7 +35,6 @@ import com.google.common.truth.SimpleSubjectBuilder;
|
|||||||
import com.google.common.truth.Subject;
|
import com.google.common.truth.Subject;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -64,7 +63,7 @@ public class TextDiffSubject extends Subject {
|
|||||||
|
|
||||||
private final ImmutableList<String> actual;
|
private final ImmutableList<String> actual;
|
||||||
private DiffFormat diffFormat = DiffFormat.SIDE_BY_SIDE_MARKDOWN;
|
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) {
|
protected TextDiffSubject(FailureMetadata metadata, List<String> actual) {
|
||||||
super(metadata, actual);
|
super(metadata, actual);
|
||||||
@@ -86,8 +85,8 @@ public class TextDiffSubject extends Subject {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** If set, ignore lines that start with the given string. */
|
/** If set, ignore lines that start with the given string. */
|
||||||
public TextDiffSubject ignoringLinesThatStartWith(String comment) {
|
public TextDiffSubject ignoringLinesStartingWith(String... comments) {
|
||||||
comments.add(comment);
|
this.comments = ImmutableList.copyOf(comments);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -115,7 +115,7 @@ class SchemaTest {
|
|||||||
Joiner.on(File.separatorChar).join(MOUNTED_RESOURCE_PATH, DUMP_OUTPUT_FILE));
|
Joiner.on(File.separatorChar).join(MOUNTED_RESOURCE_PATH, DUMP_OUTPUT_FILE));
|
||||||
|
|
||||||
assertThat(dumpedSchema)
|
assertThat(dumpedSchema)
|
||||||
.ignoringLinesThatStartWith("--")
|
.ignoringLinesStartingWith("--")
|
||||||
.hasSameContentAs(Resources.getResource("sql/schema/nomulus.golden.sql"));
|
.hasSameContentAs(Resources.getResource("sql/schema/nomulus.golden.sql"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user