### Question:
BarrierImplementation implements Barrier, BarrierGroup.Listener { @Override public void cancel() throws CommunicationException { synchronized (m_condition) { m_state.cancel(this); } } BarrierImplementation(BarrierGroup group,
                               BarrierIdentity.Factory identityFactory); @Override void await(); @Override boolean await(long timeout, TimeUnit unit); @Override boolean await(long timeout); @Override void awaken(Set<BarrierIdentity> waiters); @Override void cancel(); @Override String getName();  }### Answer:
@Test public void testCancelVirginBarrier() throws Exception { final BarrierImplementation b = new BarrierImplementation(m_barrierGroup, m_identityFactory); reset(m_barrierGroup); b.cancel(); verify(m_barrierGroup).cancelWaiter(ID1); verify(m_barrierGroup).removeBarriers(1); verify(m_barrierGroup).removeListener(b); verifyNoMoreInteractions(m_barrierGroup); b.cancel(); verifyNoMoreInteractions(m_barrierGroup); }