complete code&add test case