Refactored rule test to use mock objects.