refactor unit test from ep12