add missing unit test for locker and did some refactor