refactored tests for chapter 5