Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
Cwa App Android
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Felix Foertsch
Cwa App Android
Commits
5dc5a59e
Commit
5dc5a59e
authored
4 years ago
by
Mohamed Metwalli
Browse files
Options
Downloads
Patches
Plain Diff
Fix unit test
parent
d2152ad4
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Corona-Warn-App/src/test/java/de/rki/coronawarnapp/util/DataBindingAdaptersTest.kt
+17
-10
17 additions, 10 deletions
...java/de/rki/coronawarnapp/util/DataBindingAdaptersTest.kt
with
17 additions
and
10 deletions
Corona-Warn-App/src/test/java/de/rki/coronawarnapp/util/DataBindingAdaptersTest.kt
+
17
−
10
View file @
5dc5a59e
...
...
@@ -5,13 +5,11 @@ import android.graphics.drawable.Drawable
import
android.widget.Switch
import
com.airbnb.lottie.LottieAnimationView
import
com.airbnb.lottie.LottieDrawable
import
de.rki.coronawarnapp.CoronaWarnApplication
import
de.rki.coronawarnapp.R
import
io.mockk.MockKAnnotations
import
io.mockk.every
import
io.mockk.impl.annotations.MockK
import
io.mockk.mockk
import
io.mockk.mockkObject
import
io.mockk.spyk
import
io.mockk.verify
import
io.mockk.verifySequence
...
...
@@ -29,7 +27,6 @@ class DataBindingAdaptersTest {
@Before
fun
setUp
()
{
MockKAnnotations
.
init
(
this
)
mockkObject
(
CoronaWarnApplication
)
}
private
fun
setChecked
(
status
:
Boolean
?)
{
...
...
@@ -68,9 +65,13 @@ class DataBindingAdaptersTest {
}
private
fun
setAnimation
(
animation
:
Int
?)
{
every
{
CoronaWarnApplication
.
getAppContext
().
resources
.
getResourceTypeName
(
any
())
}
returns
"raw"
val
animationView
=
mockk
<
LottieAnimationView
>(
relaxUnitFun
=
true
)
val
animationView
=
mockk
<
LottieAnimationView
>(
relaxUnitFun
=
true
).
apply
{
every
{
context
}
returns
mockk
<
Context
>().
apply
{
every
{
applicationContext
}
returns
mockk
<
Context
>().
apply
{
every
{
resources
.
getResourceTypeName
(
any
())
}
returns
"raw"
}
}
}
setAnimation
(
animationView
,
animation
)
...
...
@@ -80,6 +81,7 @@ class DataBindingAdaptersTest {
if
(
animation
!=
null
)
{
verifySequence
{
animationView
.
context
animationView
.
setAnimation
(
animation
)
animationView
.
repeatCount
=
LottieDrawable
.
INFINITE
animationView
.
repeatMode
=
LottieDrawable
.
RESTART
...
...
@@ -106,10 +108,14 @@ class DataBindingAdaptersTest {
}
private
fun
setDrawable
(
drawableId
:
Int
?)
{
every
{
CoronaWarnApplication
.
getAppContext
().
resources
.
getResourceTypeName
(
any
())
}
returns
DRAWABLE_TYPE
every
{
CoronaWarnApplication
.
getAppContext
().
getDrawable
(
any
())
}
returns
drawable
val
animationView
=
mockk
<
LottieAnimationView
>(
relaxUnitFun
=
true
)
val
animationView
=
mockk
<
LottieAnimationView
>(
relaxUnitFun
=
true
).
apply
{
every
{
context
}
returns
mockk
<
Context
>().
apply
{
every
{
applicationContext
}
returns
mockk
<
Context
>().
apply
{
every
{
resources
.
getResourceTypeName
(
any
())
}
returns
DRAWABLE_TYPE
every
{
getDrawable
(
any
())
}
returns
this
@DataBindingAdaptersTest
.
drawable
}
}
}
setAnimation
(
animationView
,
drawableId
)
...
...
@@ -122,6 +128,7 @@ class DataBindingAdaptersTest {
if
(
drawableId
!=
null
)
{
verifySequence
{
animationView
.
context
animationView
.
setImageDrawable
(
any
())
}
}
else
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment