Issue
I created a shadow class that calls into the real object as described in http://robolectric.org/extending:
@Implements(View::class)
class MyShadowView {
@RealObject
private lateinit var realView: View
@Implementation
fun animate(): ViewPropertyAnimator {
return realView.animate() // this call ends up calling my shadow's animate() function recursively
}
}
However, when my shadow method gets executed, it results in an infinite recursion.
What am I doing wrong?
(I'm using Robolectric 4.2.)
Solution
According to http://robolectric.org/javadoc/4.1/org/robolectric/shadow/api/Shadow.html it should be something like this:
@Implementation
fun animate(): ViewPropertyAnimator {
Shadow.directlyOn(realView, View::class.java).animate()
}
Answered By - Artur Bakiev
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.