### Question:
BlackMarket { public void buyTicket() throws InterruptedException { tickets.acquire(); }  void buyTicket(); void sellTicket();  }### Answer:
@Test public void testBlockingBehavior() throws Exception { final AtomicBoolean blocked = new AtomicBoolean(true); Thread buyer = new Thread() { @Override public void run() { try { new BlackMarket().buyTicket(); blocked.set(false); } catch (InterruptedException success) { } } }; buyer.start(); Thread.sleep(1000); buyer.interrupt(); buyer.join(1000); Assert.assertFalse("Thread didn't interrupt!", buyer .isAlive()); Assert.assertTrue("Method didn't block!", blocked.get()); }