public void testStopsWhenQueryBetterThanElapsed() throws Exception {
   System.gc();
   BestQueryExplainer bq = new BestQueryExplainer();
   bq.add(q1); // Takes 600 milliseconds
   Thread.sleep(700);
   try {
     bq.add(q2);
     fail("Expected: BestQueryException");
   } catch (BestQueryException e) {
   }
 }
  public void testReturnBest() throws Exception {
    System.gc();
    BestQueryExplainer bq = new BestQueryExplainer();
    bq.add(q1);
    bq.add(q2);
    assertEquals(q1, bq.getBestQuery());

    bq = new BestQueryExplainer();
    bq.add(q2);
    bq.add(q1);
    assertEquals(q1, bq.getBestQuery());
  }