write controller test cases