test 4: refactor code, make generic dao, refactor test function name