public void testRemoveNextHatchedUninterruptibly() { qi.incubate(a); qi.incubate(b); qi.incubate(c); qi.hatch(c); qi.hatch(b); qi.hatch(a); assertEquals(a, qi.removeNextHatchedUninterruptibly()); assertEquals(b, qi.removeNextHatchedUninterruptibly()); assertEquals(c, qi.removeNextHatchedUninterruptibly()); qi.incubate(d); new Thread() { public void run() { try { Thread.sleep(10); } catch (InterruptedException e) { } qi.hatch(d); } }.run(); assertEquals(d, qi.removeNextHatchedUninterruptibly()); }
public void testIsEmpty() { assertEquals(true, qi.isEmpty()); qi.incubate(a); assertEquals(false, qi.isEmpty()); qi.hatch(a); assertEquals(false, qi.isEmpty()); qi.removeNextHatchedUninterruptibly(); assertEquals(true, qi.isEmpty()); }