refactor unittest