Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/main/java/graphql/schema/diff/SchemaDiff.java
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public static Options defaultOptions() {

private static class CountingReporter implements DifferenceReporter {
final DifferenceReporter delegate;
int breakingCount = 1;
int breakingCount = 0;

private CountingReporter(DifferenceReporter delegate) {
this.delegate = delegate;
Expand Down
21 changes: 21 additions & 0 deletions src/test/groovy/graphql/schema/diff/SchemaDiffTest.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -570,4 +570,25 @@ class SchemaDiffTest extends Specification {

}

def "SchemaDiff and CapturingReporter have the same diff counts"() {
def schema1 = TestUtil.schema("type Query { f : String }")
def schema2 = TestUtil.schema("type Query { f : Int }")

when:
def capturingReporter = new CapturingReporter()
def schemaDiff = new SchemaDiff()
def breakingCount = schemaDiff.diffSchema(DiffSet.diffSet(schema1, schema1), capturingReporter)
then:
breakingCount == capturingReporter.getBreakageCount()
breakingCount == 0

when:
capturingReporter = new CapturingReporter()
schemaDiff = new SchemaDiff()
breakingCount = schemaDiff.diffSchema(DiffSet.diffSet(schema1, schema2), capturingReporter)

then:
breakingCount == capturingReporter.getBreakageCount()
breakingCount == 1
}
}