@Test
public void testLockWithProperAuth() throws InterruptedException, IOException {

  final LockingManagement memoryLockManager = new MemoryLockManager("default");
  final Transaction t1 = Transaction.AUTO_COMMIT;
  final DefaultTransaction t2 = new DefaultTransaction();
  t2.addAuthorization("auth5");
  final FeatureLock lock = new FeatureLock("auth5", 1 /* minute */);
  memoryLockManager.lockFeatureID("sometime", "f5", t1, lock);
  final Thread commiter = new Thread(new Runnable() {
    @Override
    public void run() {
      try {
        Thread.sleep(4000);
        memoryLockManager.release("auth5", t1);
      } catch (final InterruptedException e) {
        e.printStackTrace();
        throw new RuntimeException(e);
      } catch (final IOException e) {
        e.printStackTrace();
        throw new RuntimeException(e);
      }
    }
  });
  final long currentTime = System.currentTimeMillis();
  commiter.start();
  memoryLockManager.lock(t2, "f5");
  assertTrue((System.currentTimeMillis() - currentTime) < 4000);
  commiter.join();
}