Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/batch-file/5.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 如何测试片段的onCreateView()并在RecyclerView上显示数据?_Android_Unit Testing_Android Espresso - Fatal编程技术网

Android 如何测试片段的onCreateView()并在RecyclerView上显示数据?

Android 如何测试片段的onCreateView()并在RecyclerView上显示数据?,android,unit-testing,android-espresso,Android,Unit Testing,Android Espresso,我在onViewCreated of Fragment中使用Reformation2.0从服务器请求数据,并通过RecyclerView显示接收到的数据 想知道如何通过浓缩咖啡进行测试吗 @Override public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); mRecipePresente

我在onViewCreated of Fragment中使用Reformation2.0从服务器请求数据,并通过RecyclerView显示接收到的数据 想知道如何通过浓缩咖啡进行测试吗

@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);
    mRecipePresenter.loadData("");
}
   private void updateContent(List<Recipe> recipes) {
    mRecyclerView.setAdapter(mRecipeAdapter);
    mRecipeAdapter.setRecipes(recipes);
}

我发现一些示例在单击按钮时进行测试,需要通过RecyclerView测试onCreate和接收的数据显示。您的意思是要测试recycler视图是否填充了数据?是的,主要是如何测试这两种方法