@Test
public void createsProfiledLockIfProfilingIsEnabled() {

  Configuration config = createNiceMock(Configuration.class);
  expect(config.isServerLocksProfilingEnabled()).andReturn(true);
  replayAll();
  LockFactory factory = new LockFactory(config);
  Lock lock = factory.newLock();
  Assert.assertTrue(lock instanceof ProfiledReentrantLock);
  String label = ((ProfiledLock) lock).getLabel();
  Assert.assertTrue(label, label.contains("LockFactoryTest.java"));
  verifyAll();
}