Я обновил свои зависимости тестовых случаев от этого от этого (как указано ниже в фрагменте кода), с тех пор я сталкиваюсь с этой ошибкой java.lang.nullpointerException: не может работать на одном уровне, поскольку активность уже была уничтожена Полем в то время как ранее этот тест работал нормально.
// this
testImplementation 'org.robolectric:robolectric:4.5-beta-1'
testImplementation 'androidx.test.espresso:espresso-core:3.4.0'
testImplementation 'androidx.test.espresso:espresso-contrib:3.4.0'
androidTestImplementation 'androidx.test:rules:1.4.0'
// to this
testImplementation 'org.robolectric:robolectric:4.14.1'
testImplementation 'androidx.test.espresso:espresso-core:3.6.1'
testImplementation 'androidx.test.espresso:espresso-contrib:3.6.1'
androidTestImplementation 'androidx.test:rules:1.6.1'
@RunWith(AndroidJUnit4.class)
public class NfcCardReaderActivityTest {
@Rule
public ActivityScenarioRule scenarioRule
= new ActivityScenarioRule(NfcCardReaderActivity.class);
@Test
public void testHelperIsShown() {
scenarioRule.getScenario().onActivity(activity -> {
activity.onResume();
checkHasText(
activity,
R.id.info_text,
R.string.helper_description
);
});
}
Подробнее здесь: https://stackoverflow.com/questions/794 ... the-activi