`Asserts.succeedsEventually(new Runnable() { public void run() {assertEquals(x[0], 1); } });` will avoid waiting 5000ms when 1ms might have done.