  @Test
  public void testRace () throws Exception
  {

    synchronized (this.lock_)
    {
      Promise<Integer> p =
          Promise.race (
              new Promise<> (settlement -> {
                {
                  try
                  {
                    Thread.sleep (500);
                    settlement.resolve (10);
                  }
                  catch (InterruptedException e)
                  {
                    settlement.reject (e);
                  }
                }
              }),
              new Promise<> (settlement -> {
                {
                  try
                  {
                    Thread.sleep (300);
                    settlement.resolve (20);
                  }
                  catch (InterruptedException e)
                  {
                    settlement.reject (e);
                  }
                }
              }),
              new Promise<> (settlement -> {
                {
                  try
                  {
                    Thread.sleep (600);
                    settlement.resolve (30);
                  }
                  catch (InterruptedException e)
                  {
                    settlement.reject (e);
                  }
                }
              })
          );

      p.then (resolved (value -> {
        Assert.assertEquals (20, (int) value);

        Assert.assertFalse (isComplete_);
        isComplete_ = true;

        synchronized (lock_)
        {
          lock_.notify ();
        }
      }))
       ._catch (rejected (reason -> Assert.fail ()));

      this.lock_.wait (5000);

      Assert.assertTrue (this.isComplete_);
    }
  }