mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-26 20:33:53 +01:00
Fix Crash Edit Categories Fragment (#5510)
* fix crash * Tests Added * Tests and Null Checks Added
This commit is contained in:
parent
535792390e
commit
f5a5159f8c
2 changed files with 25 additions and 10 deletions
|
|
@ -4,6 +4,7 @@ import android.app.ProgressDialog
|
|||
import android.content.Context
|
||||
import android.os.Looper
|
||||
import android.text.Editable
|
||||
import android.util.Log
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.widget.Button
|
||||
|
|
@ -116,7 +117,6 @@ class UploadCategoriesFragmentUnitTests {
|
|||
Whitebox.setInternalState(fragment, "pbCategories", pbCategories)
|
||||
Whitebox.setInternalState(fragment, "tilContainerEtSearch", tilContainerEtSearch)
|
||||
Whitebox.setInternalState(fragment, "adapter", adapter)
|
||||
Whitebox.setInternalState(fragment, "callback", callback)
|
||||
Whitebox.setInternalState(fragment, "presenter", presenter)
|
||||
Whitebox.setInternalState(fragment, "etSearch", etSearch)
|
||||
Whitebox.setInternalState(fragment, "rvCategories", rvCategories)
|
||||
|
|
@ -365,4 +365,15 @@ class UploadCategoriesFragmentUnitTests {
|
|||
method.invoke(fragment)
|
||||
}
|
||||
|
||||
}
|
||||
@Test
|
||||
@Throws(Exception::class)
|
||||
fun `Test init when callback is null`() {
|
||||
Shadows.shadowOf(Looper.getMainLooper()).idle()
|
||||
val method: Method = UploadCategoriesFragment::class.java.getDeclaredMethod(
|
||||
"init"
|
||||
)
|
||||
method.isAccessible = true
|
||||
method.invoke(fragment)
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue