added test and method for exercise 7