Untitled

 avatar
unknown
plain_text
3 years ago
976 B
4
Indexable
class WebClientUtilsSpec extends Specification {
    static def BASE_URL = 'https://www.example.com'

    def "that proper url is built with given parameters"() {
        when:
        def url = WebClientUtils.interpolateUriVariables(uri, variables)

        then:
        url == expectedUrl

        where:
        variables                                                  | uri                                                             || expectedUrl
        ['firstParam': 'firstValue']                               | BASE_URL + '?firstParam={firstParam}'                           || BASE_URL + '?firstParam=firstValue'
        ['firstParam': 'firstValue', 'secondParam': 'secondValue'] | BASE_URL + '?firstParam={firstParam}&secondParam={secondParam}' || BASE_URL + '?firstParam=firstValue&secondParam=secondValue'
        ['invalidParam': 'invalidValue']                           | BASE_URL                                                        || BASE_URL
    }
}
Editor is loading...