updated the test to use a spy to see if the method was called.