It should to recall that the calculate() method is now called in the doInBackground()
method of AsyncTask
class. This method is not called in the main flow and getInstrumentation ().waitForIdleSync()
tool waits until the queue at the base stream will stand not empty. In consequence of that, there is a problem in that the check of the results occurs earlier than all the streams are synchronized. It is certainly is not satisfied us.
There is a necessary to carry out an artificial synchronization for correct test passing.
It can be done in the following ways: