Lack { public void acquire(String resource) throws LackException { ResultSet result = statements.acquire(resource, owner); if (!result.wasApplied()) { throw new LackException(String.format(MESSAGE_ACQUIRE, resource)); } } Lack(LackConfig lackConfig, String owner); void acquire(String resource); void claim(String resource); void renew(String resource); void release(String resource); void stop();  }
@Test public void alreadyLocked() throws LackException { lack.acquire(resource); thrown.expect(LackException.class); lack.acquire(resource); }
@Test public void alreadyLockedByOther() throws LackException { lack.acquire(resource); thrown.expect(LackException.class); otherLack.acquire(resource); }
@Test public void testReleaseAfterTtl() throws Exception { lack.acquire(resource); Thread.sleep(3400); otherLack.acquire(resource); }