The testEntry method is invoked before an entity enters a storage. This method allows to either accept or refuse an entity from entering that particular storage. In the case of the storage for Task entities, the callback method name would be TaskTestEntry and for the Failure storage it would be FailureTestEntry.
For this example, when a Failure entity arrives into storage 2, an internal flag can be set in the block that would block Task entities from entering the block. When we are done processing the Failure entity, we can reset the flag so that we can start accepting entities into Storage 1. To check if any entities are waiting to enter storage 1, we can schedule a testEntry event for storage 1.