finished unit test refactor for controller