### Question:
ViewPropertyAnimatorCompat { public ViewPropertyAnimatorCompat withEndAction(Runnable runnable) { View view; if ((view = mView.get()) != null) { if (Build.VERSION.SDK_INT >= 16) { view.animate().withEndAction(runnable); } else { setListenerInternal(view, new ViewPropertyAnimatorListenerApi14(this)); mEndAction = runnable; } } return this; } ViewPropertyAnimatorCompat(View view); ViewPropertyAnimatorCompat setDuration(long value); ViewPropertyAnimatorCompat alpha(float value); ViewPropertyAnimatorCompat alphaBy(float value); ViewPropertyAnimatorCompat translationX(float value); ViewPropertyAnimatorCompat translationY(float value); ViewPropertyAnimatorCompat withEndAction(Runnable runnable); long getDuration(); ViewPropertyAnimatorCompat setInterpolator(Interpolator value); Interpolator getInterpolator(); ViewPropertyAnimatorCompat setStartDelay(long value); long getStartDelay(); ViewPropertyAnimatorCompat rotation(float value); ViewPropertyAnimatorCompat rotationBy(float value); ViewPropertyAnimatorCompat rotationX(float value); ViewPropertyAnimatorCompat rotationXBy(float value); ViewPropertyAnimatorCompat rotationY(float value); ViewPropertyAnimatorCompat rotationYBy(float value); ViewPropertyAnimatorCompat scaleX(float value); ViewPropertyAnimatorCompat scaleXBy(float value); ViewPropertyAnimatorCompat scaleY(float value); ViewPropertyAnimatorCompat scaleYBy(float value); void cancel(); ViewPropertyAnimatorCompat x(float value); ViewPropertyAnimatorCompat xBy(float value); ViewPropertyAnimatorCompat y(float value); ViewPropertyAnimatorCompat yBy(float value); ViewPropertyAnimatorCompat translationXBy(float value); ViewPropertyAnimatorCompat translationYBy(float value); ViewPropertyAnimatorCompat translationZBy(float value); ViewPropertyAnimatorCompat translationZ(float value); ViewPropertyAnimatorCompat z(float value); ViewPropertyAnimatorCompat zBy(float value); void start(); ViewPropertyAnimatorCompat withLayer(); ViewPropertyAnimatorCompat withStartAction(Runnable runnable); ViewPropertyAnimatorCompat setListener(final ViewPropertyAnimatorListener listener); ViewPropertyAnimatorCompat setUpdateListener(
            final ViewPropertyAnimatorUpdateListener listener);  }### Answer:
@Test public void testWithEndAction() throws Throwable { final CountDownLatch latch1 = new CountDownLatch(1); mActivityTestRule.runOnUiThread(new Runnable() { @Override public void run() { ViewCompat.animate(mView).alpha(0).setDuration(100).withEndAction(new Runnable() { @Override public void run() { latch1.countDown(); } }); } }); assertTrue(latch1.await(300, TimeUnit.MILLISECONDS)); mNumListenerCalls = 0; final CountDownLatch latch2 = new CountDownLatch(1); mActivityTestRule.runOnUiThread(new Runnable() { @Override public void run() { ViewCompat.animate(mView).alpha(0).setDuration(50).withEndAction(new Runnable() { @Override public void run() { ++mNumListenerCalls; ViewCompat.animate(mView).alpha(1); latch2.countDown(); } }); } }); assertTrue(latch2.await(200, TimeUnit.MILLISECONDS)); waitAndCheckCallCount(1); }