@Test
public void testCleanTimeExpiredLock() throws IOException {

  ThemisMasterObserver masterObserver = new ThemisMasterObserver();
  masterObserver.connection = connection;
  masterObserver.lockCleaner = new ServerLockCleaner(masterObserver.connection,
    new ThemisCoprocessorClient(connection));
  writeLockAndData(COLUMN, prewriteTs);
  writeLockAndData(COLUMN_WITH_ANOTHER_TABLE, prewriteTs + 1);
  // won't clear lock
  masterObserver.cleanLockBeforeTimestamp(prewriteTs);
  checkPrewriteColumnSuccess(COLUMN, prewriteTs);
  checkPrewriteColumnSuccess(COLUMN_WITH_ANOTHER_TABLE, prewriteTs + 1);
  
  // will clear lock of one COLUMN
  masterObserver.cleanLockBeforeTimestamp(prewriteTs + 1);
  Assert.assertNull(readLockBytes(COLUMN, prewriteTs));
  checkPrewriteColumnSuccess(COLUMN_WITH_ANOTHER_TABLE, prewriteTs + 1);
  
  // will clear locks for both COLUMNs
  writeLockAndData(COLUMN, prewriteTs + 1);
  masterObserver.cleanLockBeforeTimestamp(prewriteTs + 2);
  Assert.assertNull(readLockBytes(COLUMN, prewriteTs + 1));
  Assert.assertNull(readLockBytes(COLUMN_WITH_ANOTHER_TABLE, prewriteTs + 1));
  
  writeLockAndData(COLUMN, prewriteTs + 100);
}