// Project: Patterns2 // Module: Elevator // Source code file: Test.java // Illustrates the State Pattern with two states. // Test file public class Test { public static void main(String[ ] args) { StateManager sm = new StateManager( ); sm.pressFirstFloorButton( ); sm.pressSecondFloorButton( ); sm.pressSecondFloorButton( ); sm.pressFirstFloorButton( ); } } // Output: // Already on first floor. // Going to second floor. // Already on second floor. // Going to first floor.