update all of chapter 4 to use tests