@@ -0,0 +1,1385 @@
+package design_patterns.observer_design_pattern;%0Aimport design_patterns.observer_design_pattern.Observer;%0Aimport design_patterns.observer_design_pattern.Subject;%0Aimport design_patterns.observer_design_pattern.ModeChanger;%0Aimport design_patterns.observer_design_pattern.ModeObserver;%0A%0A/*%0A%09Class to test Observer Design Pattern%0A*/%0A%0Aclass TestObserver%7B%0A%0A%0A%09public static void testA()%7B%0A%0A%09%09// Create ModeChanger%0A%09%09ModeChanger mc = new ModeChanger();%0A%0A%09%09// Create three subscribers%0A%09%09ModeObserver ob1 = new ModeObserver();%0A%09%09ModeObserver ob2 = new ModeObserver();%0A%09%09ModeObserver ob3 = new ModeObserver();%0A%0A%09%09// Change mode%0A%09%09System.out.println(%22%5CnChanging Mode to set%22);%0A%09%09mc.set();%0A%0A%09%09// ob1 subscribes%0A%09%09ob1.subscribe(mc);%0A%0A%09%09// Change mode%0A%09%09System.out.println(%22%5CnChanging Mode to reset%22);%0A%09%09mc.reset();%09%09%0A%0A%09%09// ob2 subscribes%0A%09%09ob2.subscribe(mc);%0A%0A%09%09// Change mode set%0A%09%09System.out.println(%22%5CnChanging Mode to set%22);%0A%09%09mc.set();%0A%0A%09%09// ob1 unsubscribes%0A%09%09ob1.unsubscribe(mc);%0A%0A%09%09// Change mode%0A%09%09System.out.println(%22%5CnChanging Mode to reset%22);%0A%09%09mc.reset();%09%09%09%09%0A%0A%09%09// ob2 unsubscribes%0A%09%09ob2.unsubscribe(mc);%0A%0A%09%09// Change mode set%0A%09%09System.out.println(%22%5CnChanging Mode to set%22);%0A%09%09mc.set();%0A%0A%09%09// ob3 subscribes%0A%09%09ob3.subscribe(mc);%0A%0A%09%09// Change mode%0A%09%09System.out.println(%22%5CnChanging Mode to reset%22);%0A%09%09mc.reset();%09%09%09%09%09%09%0A%0A%0A%0A%0A%09%7D%0A%0A%0A%09public static void main(String args%5B%5D)%7B%0A%0A%09%09testA();%0A%09%7D%0A%0A%0A%7D%09

Add test class for observer design pattern