VariableLatch latch = new VariableLatch();
latch.up();
long start = System.currentTimeMillis();
Assert.assertFalse(latch.waitCompletion(1000));
long end = System.currentTimeMillis();
Assert.assertTrue("Timeout didn't work correctly", end - start >= 1000 && end - start < 2000);
}
}