Code example for TimeoutException

0
          // we could wait forever. 
          observer.check(); 
        } 
      }); 
      if (!has_index.await(1000, TimeUnit.MILLISECONDS)) { 
        throw new TimeoutException(); 
      } 
    } finally { 
      runTestOnUiThread(new Runnable() { 
        public void run() { 
          adapter.unregisterDataSetObserver(observer); 
        } 
      }); 
    } 
  } 
 
  private Synchroniser synchroniser;
  private Mockery mockery;
  private MockContentResolver content_resolver;
  private Context context;
  private MockableContentProvider.Interface nextmuni_provider;