Back to project page Butler.
The source code is released under:
Apache License
If you think the Android project Butler listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.bingzer.android; /*from w ww . j a v a2 s . co m*/ import android.test.AndroidTestCase; import java.util.concurrent.CountDownLatch; import static com.bingzer.android.Async.doAsync; public class AsyncTest extends AndroidTestCase { int counter = 0; public void test_doAsync() throws InterruptedException { final CountDownLatch signal = new CountDownLatch(1); doAsync(new Task<Object>() { @Override public void onCompleted(Object result) { ++counter; signal.countDown(); } }, new Delegate<Object>() { @Override public Object invoke() { return null; } }); signal.await(); assertTrue(counter > 0); } }