refactor assertion