Why does this code:
public class SomeTest extends InstrumentationTestCase {
@UiThreadTest
public void testSubscribe_noErrorHandler_threadingCorrect() throws Throwable {
android.util.Log.i("Now@" + Thread.currentThread().currentThread().getId());
runTestOnUiThread(new Runnable() {
@Override
public void run() {
android.util.Log.i("Later@" + Thread.currentThread().currentThread().getId());
}
});
}
}
..produce this output:
09-11 15:20:10.783 5155-5170/com.agens.android.vgsnarvei I/﹕ Now@2018
09-11 15:20:10.783 5155-5155/com.agens.android.vgsnarvei I/﹕ Later@1
I expected Now@1
, Later@1
, given that the documentation of @UiThreadTest
claims it's supposes to run on the UI thread