I am writing Junit test case for a method which does a job in background thread. To test the flow, I am planning to write a ExecutorService that I can use in my testcase. The ExecutorService should run the job in main thread. What I mean is that ExecutorService implementation should use the main thread to execute any task submitted to it. It must not create any worker thread. Anyone has sample code for that?
Kovychi
Level 0
How to create Java ExecutorService object that runs task in main thread?
Comments (1)
- Popular
- New
- Old
You must be signed in to leave a comment
Kovychi
19 June 2022, 08:22
Found the answer here.
0