A State-Based Approach to the Testing of Class-Based Programs