mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-28 05:13:53 +01:00
Add Unit Tests for CategoryEditSearchRecyclerViewAdapter (#4775)
* Add Unit Tests for CategoryEditSearchRecyclerViewAdapter * Use mock context instead of robolectric context
This commit is contained in:
parent
54676ba0d7
commit
ff8f067841
2 changed files with 88 additions and 20 deletions
|
|
@ -47,32 +47,12 @@ public class CategoryEditSearchRecyclerViewAdapter
|
|||
}
|
||||
}
|
||||
|
||||
public void addToCategories(String categoryToBeAdded) {
|
||||
if (!categories.contains(categoryToBeAdded)) {
|
||||
categories.add(categoryToBeAdded);
|
||||
}
|
||||
}
|
||||
|
||||
public void removeFromCategories(String categoryToBeRemoved) {
|
||||
if (categories.contains(categoryToBeRemoved)) {
|
||||
categories.remove(categoryToBeRemoved);
|
||||
}
|
||||
}
|
||||
|
||||
public void removeFromNewCategories(String categoryToBeRemoved) {
|
||||
if (newCategories.contains(categoryToBeRemoved)) {
|
||||
newCategories.remove(categoryToBeRemoved);
|
||||
}
|
||||
}
|
||||
|
||||
public void addToNewCategories(List<String> newCategories) {
|
||||
for(String category : newCategories) {
|
||||
if (!this.newCategories.contains(category)) {
|
||||
this.newCategories.add(category);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void addToNewCategories(String addedCategory) {
|
||||
if (!newCategories.contains(addedCategory)) {
|
||||
newCategories.add(addedCategory);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue