add test code for register.