title: How do I unit test Android code that has View Animators?
body: <p>I have an instance where a couple buttons are shown and hidden depending on which page in a ViewPager is being shown. The are shown and hidden with Animators. Is there a way to check for/delay unit testing until this has been completed?</p>
  
  <p>I'm using Robolectric since that's probably relevant. I tried calling <code>Robolectric.runUiThreadTasksIncludingDelayedTasks();</code> but this didn't seem to fix anything. </p>
  
  <p>The animation code is as follows:</p>
  
  <pre><code>public static void regularFadeView(final boolean show, final View view) {
      view.animate()
              .setInterpolator(mDecelerateInterpolator)
              .alpha(show ? 1 : 0)
              .setListener(new SimpleAnimatorListener() {
                  @Override
                  public void onAnimationStart(Animator animation) {
                      if (show) view.setVisibility(View.VISIBLE);
                  }
  
                  @Override
                  public void onAnimationEnd(Animator animation) {
                      if (!show) view.setVisibility(View.INVISIBLE);
                  }
              })
              .start();
  }
  </code></pre>