I wish this helpful for you To test the runnable running in a separate thread, the JUnit test should (1) construct the runnable, (2) start a thread constructed on the runnable, (3) queue a few entries, (4) wait for a short period, (5) call stop(), and (6) check that all entries got processed. In this case, your code will fail the test since your run() method does not have a loop and thus will only process the first entry. It also doesn't have any code for processing the entry and doesn't compile yet.
may help you . You get that exception when the class that you passed in the command line arguments doesn't have any methods annotated with @Test. In this case, TestRunner doesn't have any methods annotated with @Test. To run your unit tests, do: