android - Esspresso assertThat 在验证导航时需要额外的匹配器
问题描述
我正在按照Google 的示例使用模拟 navControllor 测试我的片段。我做的一切都是一样的,我在使用 assertThat 时从 Espresso 收到这个错误。我收到的错误消息
看来我需要传入一个不在 Google 提供的示例中的附加匹配器。我不知道为什么需要这个匹配器。
我的依赖版本:
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
任何帮助表示赞赏!谢谢!
解决方案
来自文档的assertThat
来自Truth,您可以通过 Gradle 依赖项将其添加到您的项目中:
androidTestImplementation "com.google.truth:truth:1.0.1"
推荐阅读
- wpf - WPF c#一个带有文本框的按钮
- flutter - 是否可以在 Flutter 中读取 Mifare Ultralight NFC 芯片?
- angularjs - 是否有用于为输入类型添加小数的过滤器?
- database - 我什么时候应该在 MongoDB 中使用 ObjectId 和 UUID
- arrays - 从对象数组创建数组数组
- vb.net - 单击后不会触发 MouseLeave 事件?
- xml - 在 JSR223 采样器中读取 xml 到字符串时出现意外令牌
- reactjs - 带有钩子的 React-Table 失去了对表内输入的关注?
- batch-file - 如何从 FOR-LOOP 修改变量结果并输出修改后的变量?
- pandas - Pandas 计算开/关事件的数量和持续时间