Added unit tests for locking