We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
运行RepoModelTest,测试testLoadRepos()方法,发现它会一直在await,结束不了。后来加入log后发现代码没有走到callback的onSuccess里面,所以没有触发latch.countDown()。跟进去RepoModel里面发现是callback.onSuccess(repos)调用的问题,直接调用的话后面是能够运行到callback的onSuccess里面的;但是如果用mUiHandler.post()来调用的话就执行不到run()里面的内容了,这是为什么呢?
The text was updated successfully, but these errors were encountered:
Handler post出来的信息不会被Robolectric立刻执行。你需要 调用一下ShadowLooper.runUiThreadTasksIncludingDelayedTasks。参考 https://stackoverflow.com/questions/18956117/robolectric-run-handler-post
ShadowLooper.runUiThreadTasksIncludingDelayedTasks
Sorry, something went wrong.
No branches or pull requests
运行RepoModelTest,测试testLoadRepos()方法,发现它会一直在await,结束不了。后来加入log后发现代码没有走到callback的onSuccess里面,所以没有触发latch.countDown()。跟进去RepoModel里面发现是callback.onSuccess(repos)调用的问题,直接调用的话后面是能够运行到callback的onSuccess里面的;但是如果用mUiHandler.post()来调用的话就执行不到run()里面的内容了,这是为什么呢?
The text was updated successfully, but these errors were encountered: