0

似乎我无法shouldMatchJson从 Kotlintest v3.4.2 访问匹配器,这种方式记录在https://github.com/kotlintest/kotlintest/blob/master/doc/matchers.md中。我得到未解决的参考,我似乎无法导入它。代码说它是 String 类的扩展方法,但尝试使用字符串甚至 """{}""" 但无法访问该方法。难道我做错了什么?所有其他匹配器都可以。

class Test : StringSpec ({
    "Test a json" {
        "{}".shouldMatchJson("{}")
    }
})

未解决的参考

4

1 回答 1

3

可能是您缺少 json 扩展的导入吗?

我的 build.gradle 中有这个:

testImplementation "io.kotlintest:kotlintest-assertions-json:3.4.2"
于 2019-11-13T17:13:09.293 回答