@Test public void whenAborted() throws InterruptedException { barrier = new VetoCommitBarrier(); barrier.abort(); boolean success = barrier.tryAwaitOpen(1, TimeUnit.DAYS); assertTrue(barrier.isAborted()); assertTrue(success); }
@Test public void whenNullTimeout_thenNullPointerException() throws InterruptedException { barrier = new VetoCommitBarrier(); try { barrier.tryAwaitOpen(1, null); fail(); } catch (NullPointerException expected) { } assertTrue(barrier.isClosed()); }
@Test public void whenAlreadyInterrupted() { Thread.currentThread().interrupt(); barrier = new VetoCommitBarrier(); try { barrier.tryAwaitOpen(1, TimeUnit.DAYS); fail(); } catch (InterruptedException expected) { } assertTrue(barrier.isClosed()); }