### Question:
BooleanMutex { public void get() throws InterruptedException { sync.innerGet(); } BooleanMutex();  BooleanMutex(Boolean mutex); void get(); void get(long timeout, TimeUnit unit); void set(Boolean mutex); boolean state();  }### Answer:
@Test public void test_init_true() { BooleanMutex mutex = new BooleanMutex(true); try { mutex.get(); } catch (InterruptedException e) { } }
@Test public void test_concurrent_true() { try { final BooleanMutex mutex = new BooleanMutex(true); final CountDownLatch count = new CountDownLatch(10); ExecutorService executor = Executors.newCachedThreadPool(); for (int i = 0; i < 10; i++) { executor.submit(new Callable() { public Object call() throws Exception { mutex.get(); count.countDown(); return null; } }); } count.await(); executor.shutdown(); } catch (InterruptedException e) { } }