Refactor test using assert