Skip to content
Merged
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
31 changes: 31 additions & 0 deletions src/test/groovy/graphql/util/PairTest.groovy
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package graphql.util

import spock.lang.Specification

class PairTest extends Specification {
def "constructor initializes fields correctly"() {
when:
def pair = new Pair<>("hello", 123)

then:
pair.first == "hello"
pair.second == 123
}

def "static pair method creates Pair instance"() {
when:
def pair = Pair.pair("foo", "bar")

then:
pair instanceof Pair
pair.first == "foo"
pair.second == "bar"
}

def "toString returns formatted string"() {
expect:
new Pair<>(1, 2).toString() == "(1, 2)"
Pair.pair("a", "b").toString() == "(a, b)"
new Pair<>(null, null).toString() == "(null, null)"
}
}