0

I'm trying to implement the solution of this answer IdlingResource Espresso with RxJava but AsyncTask.THREAD_POOL_EXECUTOR is deprecated. What I should use instead?

wasi
  • 1
  • 1
  • That answer is from seven years ago. You might want to look for newer options. – CommonsWare Jul 17 '22 at 16:57
  • @CommonsWare newer options implies touching production code and i don't like that idea. Any suggestion? – wasi Jul 17 '22 at 17:02
  • "newer options implies touching production code" -- this is not production code. Espresso idling resources and JUnit rules are test code. – CommonsWare Jul 17 '22 at 17:10
  • @CommonsWare https://developer.android.com/training/testing/espresso/idling-resource#integrate-recommended-approach Google recommends placing the idling resource logic inside production code. That's why I'm trying this approach. Do you have any suggestion? I'm misunderstanding something? – wasi Jul 17 '22 at 17:15
  • First, I disagree with that recommendation. Second, you are not implementing an Espresso idling resource. You are implementing a JUnit rule. AFAIK, that has to go in test code, as you do not have JUnit in your app code. Third, if this code does not exist yet in your project, then it is not "production code" in any case. So, I stand by my recommendation that you should look for something newer than seven years old. Or, stick with the deprecated executor. Or, try a different method on `Schedulers`. Or, create your own `Executor` to use. – CommonsWare Jul 17 '22 at 17:25
  • @CommonsWare what do you think about this possible solution? https://github.com/square/RxIdler – wasi Jul 18 '22 at 16:22
  • Square does excellent work. While I have a lot of faith in Mike (author of the answer you were working with), I'd lean toward a library from Square like that one. – CommonsWare Jul 18 '22 at 16:38

0 Answers0