Add Unit Tests for CategoryEditSearchRecyclerViewAdapter (#4775)

* Add Unit Tests for CategoryEditSearchRecyclerViewAdapter

* Use mock context instead of robolectric context
This commit is contained in:
Madhur Gupta 2022-02-02 11:54:32 +05:30 committed by GitHub
parent 54676ba0d7
commit ff8f067841
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 88 additions and 20 deletions

View file

@ -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);