mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-26 12:23:58 +01:00
#3832 Remove unused code via Declaraction Redundancy>Unused Declaration Inspection - fix TextUtils usage
This commit is contained in:
parent
f8f08f0f14
commit
2ad8663e24
3 changed files with 6 additions and 7 deletions
|
|
@ -1,6 +1,5 @@
|
||||||
package fr.free.nrw.commons.category
|
package fr.free.nrw.commons.category
|
||||||
|
|
||||||
import android.text.TextUtils
|
|
||||||
import fr.free.nrw.commons.upload.GpsCategoryModel
|
import fr.free.nrw.commons.upload.GpsCategoryModel
|
||||||
import fr.free.nrw.commons.upload.structure.depictions.DepictedItem
|
import fr.free.nrw.commons.upload.structure.depictions.DepictedItem
|
||||||
import fr.free.nrw.commons.utils.StringSortingUtils
|
import fr.free.nrw.commons.utils.StringSortingUtils
|
||||||
|
|
@ -82,7 +81,7 @@ class CategoriesModel @Inject constructor(
|
||||||
imageTitleList: List<String>,
|
imageTitleList: List<String>,
|
||||||
selectedDepictions: List<DepictedItem>
|
selectedDepictions: List<DepictedItem>
|
||||||
): Observable<List<String>> {
|
): Observable<List<String>> {
|
||||||
return if (TextUtils.isEmpty(term))
|
return if (term.isBlank())
|
||||||
Observable.combineLatest(
|
Observable.combineLatest(
|
||||||
categoriesFromDepiction(selectedDepictions),
|
categoriesFromDepiction(selectedDepictions),
|
||||||
gpsCategoryModel.categoriesFromLocation,
|
gpsCategoryModel.categoriesFromLocation,
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
package fr.free.nrw.commons.upload.categories
|
package fr.free.nrw.commons.upload.categories
|
||||||
|
|
||||||
import android.text.TextUtils
|
|
||||||
import fr.free.nrw.commons.R
|
import fr.free.nrw.commons.R
|
||||||
import fr.free.nrw.commons.category.CategoryItem
|
import fr.free.nrw.commons.category.CategoryItem
|
||||||
import fr.free.nrw.commons.di.CommonsApplicationModule
|
import fr.free.nrw.commons.di.CommonsApplicationModule
|
||||||
|
|
@ -84,7 +83,7 @@ class CategoriesPresenter @Inject constructor(
|
||||||
private fun getImageTitleList(): List<String> {
|
private fun getImageTitleList(): List<String> {
|
||||||
return repository.uploads
|
return repository.uploads
|
||||||
.map { it.uploadMediaDetails[0].captionText }
|
.map { it.uploadMediaDetails[0].captionText }
|
||||||
.filterNot { TextUtils.isEmpty(it) }
|
.filterNot { it.isBlank() }
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,6 @@ import android.database.MatrixCursor
|
||||||
import android.database.sqlite.SQLiteDatabase
|
import android.database.sqlite.SQLiteDatabase
|
||||||
import android.os.RemoteException
|
import android.os.RemoteException
|
||||||
import com.nhaarman.mockitokotlin2.*
|
import com.nhaarman.mockitokotlin2.*
|
||||||
import fr.free.nrw.commons.BuildConfig
|
|
||||||
import fr.free.nrw.commons.TestCommonsApplication
|
import fr.free.nrw.commons.TestCommonsApplication
|
||||||
import fr.free.nrw.commons.category.CategoryContentProvider.BASE_URI
|
import fr.free.nrw.commons.category.CategoryContentProvider.BASE_URI
|
||||||
import fr.free.nrw.commons.category.CategoryContentProvider.uriForId
|
import fr.free.nrw.commons.category.CategoryContentProvider.uriForId
|
||||||
|
|
@ -151,9 +150,11 @@ class CategoryDaoTest {
|
||||||
@Test(expected = RuntimeException::class)
|
@Test(expected = RuntimeException::class)
|
||||||
fun testSaveTranslatesRemoteExceptions() {
|
fun testSaveTranslatesRemoteExceptions() {
|
||||||
whenever(client.insert(isA(), isA())).thenThrow(RemoteException(""))
|
whenever(client.insert(isA(), isA())).thenThrow(RemoteException(""))
|
||||||
testObject.save(Category())
|
testObject.save(category())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun category() = Category(null,null,null,0)
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun whenTheresNoDataFindReturnsNull_nullCursor() {
|
fun whenTheresNoDataFindReturnsNull_nullCursor() {
|
||||||
whenever(client.query(any(), any(), any(), any(), any())).thenReturn(null)
|
whenever(client.query(any(), any(), any(), any(), any())).thenReturn(null)
|
||||||
|
|
@ -268,4 +269,4 @@ class CategoryDaoTest {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue