Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/85.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/regex/20.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 浓缩咖啡测试检查Listview中TextView的字符串值是否不存在_Android_Android Espresso_Matcher - Fatal编程技术网

Android 浓缩咖啡测试检查Listview中TextView的字符串值是否不存在

Android 浓缩咖啡测试检查Listview中TextView的字符串值是否不存在,android,android-espresso,matcher,Android,Android Espresso,Matcher,我有一个包含ArrayList的ListView。class包含字符串值,例如FoodName。现在我想检查从ListView中删除一行后,值FoodName是否不再存在于特定位置。我尝试了以下不起作用的代码: onData(anything()) .inAdapterView(withId(R.id.list)) .atPosition(0) .onChildView(withId(R.id.food_name))

我有一个包含ArrayList的ListView。class包含字符串值,例如FoodName。现在我想检查从ListView中删除一行后,值FoodName是否不再存在于特定位置。我尝试了以下不起作用的代码:

onData(anything())
            .inAdapterView(withId(R.id.list))
            .atPosition(0)
            .onChildView(withId(R.id.food_name))
            .check("I don't know how to check if string value of food_name which I deleted before does not exist here anymore")
谢谢你的帮助

您可以执行以下操作:

onData(anything())
            .inAdapterView(withId(R.id.list))
            .atPosition(0)
            .onChildView(withId(R.id.food_name))
            .check(matches(not(withText("Your old text"))));

附言:我期待着,当我面对这类问题时,这是非常有用的。

你可以做:

onData(anything())
            .inAdapterView(withId(R.id.list))
            .atPosition(0)
            .onChildView(withId(R.id.food_name))
            .check(matches(not(withText("Your old text"))));


另外,当我面对这类问题时,我会留意答案,这是非常有用的。

谢谢你的回答,我只是错过了那个不匹配的人。。。是的,我已经使用了这个备忘单,但是not()匹配器是org.hamcrest.Matchers的一个方法。这就是缺少的部分和这个匹配器的准确位置。无论如何,再次感谢!你是对的,你有时也必须了解hamcrest matchers,其中一些人在备忘单中也被指定为“对象匹配者”,我喜欢用简单的方式写测试,似乎写起来很方便,但我认为我会坚持普通的浓缩咖啡测试,首先学习浓缩咖啡测试的所有特性和功能,在其他项目中,改成咖啡师会更方便,我会或多或少地知道它会在后台做些什么感谢回答,我只是错过了那个不相配的人。。。是的,我已经使用了这个备忘单,但是not()匹配器是org.hamcrest.Matchers的一个方法。这就是缺少的部分和这个匹配器的准确位置。无论如何,再次感谢!你是对的,你有时也必须了解hamcrest matchers,其中一些人在备忘单中也被指定为“对象匹配者”,我喜欢用简单的方式写测试,似乎写起来很方便,但我认为我会坚持普通的浓缩咖啡测试,首先学习浓缩咖啡测试的所有特性和功能,在其他项目中,改成咖啡师会更方便,我会或多或少地知道它在后台会做什么