Skip to content

Commit

Permalink
[focus] Update UrlAutoCompleteFilterTest to use new API. (mozilla-mob…
Browse files Browse the repository at this point in the history
…ile/focus-android#1827)

UltraBlame original commit: 6395c8ae01e650f2d594a28803bb4777f4f97291
  • Loading branch information
marco-c committed Jun 1, 2024
1 parent 35cf3b5 commit 32a1024
Show file tree
Hide file tree
Showing 2 changed files with 93 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1185,7 +1185,6 @@
;
}
public
final
void
onAutocomplete
(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,6 @@ autocomplete
import
android
.
content
.
SharedPreferences
import
android
.
preference
.
PreferenceManager
Expand All @@ -29,6 +23,14 @@ org
.
junit
.
Assert
.
*
import
org
.
junit
.
Test
import
org
Expand All @@ -43,6 +45,12 @@ org
.
mockito
.
ArgumentCaptor
import
org
.
mockito
.
Mockito
.
*
Expand Down Expand Up @@ -75,6 +83,18 @@ InlineAutocompleteEditText
import
org
.
mozilla
.
focus
.
widget
.
InlineAutocompleteEditText
.
AutocompleteResult
import
org
.
robolectric
.
RobolectricTestRunner
Expand All @@ -92,18 +112,6 @@ robolectric
annotation
.
Config
import
java
.
util
.
Collections
import
java
.
util
.
HashSet
RunWith
(
RobolectricTestRunner
Expand Down Expand Up @@ -644,14 +652,49 @@ onFilter
text
view
)
val
captor
=
ArgumentCaptor
.
forClass
(
AutocompleteResult
:
:
class
.
java
)
verify
(
view
)
.
onAutocomplete
(
captor
.
capture
(
)
)
assertFalse
(
captor
.
value
.
isEmpty
)
assertEquals
(
completion
captor
.
value
.
text
)
}
private
Expand Down Expand Up @@ -685,9 +728,40 @@ onFilter
text
view
)
verifyZeroInteractions
val
captor
=
ArgumentCaptor
.
forClass
(
AutocompleteResult
:
:
class
.
java
)
verify
(
view
)
.
onAutocomplete
(
captor
.
capture
(
)
)
assertTrue
(
captor
.
value
.
isEmpty
)
}
}

0 comments on commit 32a1024

Please sign in to comment.