android / android/testing-samples
Reduce need to augment production code to make recyclerview more testable
- Lingua principale
- Java
- Stelle
- 9.3k
- Fork
- 3.6k
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Descrizione
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
Guida per i contributori
Apri la guida per i contributori
Direzione di ricerca
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.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- android, java
- Ambito
- mobile, testing
- Tipo di issue
- Refactoring
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Stato di attività
- Ferma
- Chiarezza
- Da chiarire
- Idoneità per principianti
- 35/100