如何在JVM单元测试中加载View静态常量

问题描述 投票:0回答:1

我有一种检查可见性是否为View.GONE的方法(仅出于测试目的)

private fun isGoneVisibility(visibility: Int): Boolean {
    return visibility == View.GONE
}

然后我在本地JVM的单元测试中将其称为。我以为在JVM测试中我们没有任何Android依赖项(因为JVM环境中没有android.jar)。但是执行测试时,它可以评估View.GONE的确切值(为8)。

我对它的工作原理一无所知。

android unit-testing testing android-testing
1个回答
1
投票

构建后,静态最终变量将覆盖值enter image description here

© www.soinside.com 2019 - 2024. All rights reserved.