android / android/testing-samples
Reduce need to augment production code to make recyclerview more testable
- Lenguaje dominante
- Java
- Estrellas
- 9.3k
- Forks
- 3.6k
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Descripción
Is this suggested best practice or can we fix this sample to provide better ways of interacting with RecyclerViews and making assertions on the viewholder?
```
@Override
public void onBindViewHolder(ViewHolder viewHolder, final int position) {
if (position == mDataSet.size() / 2 /* calculate middle element position */) {
viewHolder.setIsInTheMiddle(true);
viewHolder.getTextView().setText(mContext.getResources().getString(R.string.middle));
} else {
viewHolder.setIsInTheMiddle(false);
viewHolder.getTextView().setText(mDataSet.get(position));
}
}
```
From : https://github.com/googlesamples/android-testing/blob/master/ui/espresso/RecyclerViewSample/app/src/androidTest/java/com/example/android/testing/espresso/RecyclerViewSample/RecyclerViewSampleTest.java
Guía de contribución
Línea de trabajo
Start with RecyclerViewSampleTest.java in the linked androidTest sample and review the onBindViewHolder implementation shown in the issue. Determine whether the sample can expose better RecyclerView interactions and ViewHolder assertions without augmenting production code; done means the tests demonstrate that approach clearly.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- android, java
- Área
- mobile, testing
- Tipo de issue
- Refactorización
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Estado de actividad
- Estancado
- Claridad
- Necesita aclaración
- Aptitud para principiantes
- 35/100