File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 44 * @author jtherrell
55 */
66class Facade {
7- public void doSomething () {
8- SubsystemClassA .doSomething ();
9- SubsystemClassB .doSomething ();
10- SubsystemClassC .doSomething ();
11- SubsystemClassD .doSomething ();
7+ public void doSomething (Log log ) {
8+ SubsystemClassA .doSomething (log );
9+ SubsystemClassB .doSomething (log );
10+ SubsystemClassC .doSomething (log );
11+ SubsystemClassD .doSomething (log );
1212 }
1313}
1414
1515class SubsystemClassA {
16- public static void doSomething (){ }
16+ public static void doSomething (Log log ){ log . append ( "A" ); }
1717}
1818
1919class SubsystemClassB {
20- public static void doSomething (){ }
20+ public static void doSomething (Log log ){ log . append ( "B" ); }
2121}
2222
2323class SubsystemClassC {
24- public static void doSomething (){ }
24+ public static void doSomething (Log log ){ log . append ( "C" ); }
2525}
2626
2727class SubsystemClassD {
28- public static void doSomething (){ }
28+ public static void doSomething (Log log ){ log . append ( "D" ); }
2929}
Original file line number Diff line number Diff line change @@ -71,6 +71,7 @@ public void testPictureGetChild() {
7171 * Test
7272 */ @ Test
7373 public void testPictureDraw () {
74+ Log log = new Log ();
7475 Graphic compositeObj = new Picture ();
7576 Graphic textObj = new Text ();
7677 compositeObj .add (textObj );
Original file line number Diff line number Diff line change 1+ /*
2+ * To change this template, choose Tools | Templates
3+ * and open the template in the editor.
4+ */
5+
6+ package designpatterns ;
7+
8+ import org .junit .Test ;
9+ import static org .junit .Assert .*;
10+ /**
11+ *
12+ * @author jtherrell
13+ */
14+ public class FacadeTest {
15+ /**
16+ * Test of getInstance method, of class Singleton.
17+ */ @ Test
18+ public void testFacade () {
19+ Log log = new Log ();
20+ Facade facade = new Facade ();
21+ facade .doSomething (log );
22+ String expResult = "ABCD" ;
23+ String result = log .toString ();
24+ assertEquals (expResult , result );
25+ }
26+ }
You can’t perform that action at this time.
0 commit comments