File tree Expand file tree Collapse file tree 2 files changed +30
-18
lines changed
main/java/com/iluwatar/delegation/simple/printers
test/java/com/iluwatar/delegation/simple Expand file tree Collapse file tree 2 files changed +30
-18
lines changed Original file line number Diff line number Diff line change 1+ package com .iluwatar .delegation .simple .printers ;
2+
3+ import com .iluwatar .delegation .simple .Printer ;
4+ import com .iluwatar .delegation .simple .PrinterController ;
5+
6+ public class App {
7+
8+ public static final String MESSAGE_TO_PRINT = "hello world" ;
9+
10+ public static void main (String [] args ) {
11+ Printer hpPrinter = new HPPrinter ();
12+ Printer canonPrinter = new CanonPrinter ();
13+ Printer epsonPrinter = new EpsonPrinter ();
14+
15+ PrinterController hpPrinterController = new PrinterController (hpPrinter );
16+ PrinterController canonPrinterController = new PrinterController (canonPrinter );
17+ PrinterController epsonPrinterController = new PrinterController (epsonPrinter );
18+
19+ hpPrinterController .print (MESSAGE_TO_PRINT );
20+ canonPrinterController .print (MESSAGE_TO_PRINT );
21+ epsonPrinterController .print (MESSAGE_TO_PRINT );
22+ }
23+
24+ }
Original file line number Diff line number Diff line change 11package com .iluwatar .delegation .simple ;
22
3- import com .iluwatar .delegation .simple .printers .CanonPrinter ;
4- import com .iluwatar .delegation .simple .printers .EpsonPrinter ;
5- import com .iluwatar .delegation .simple .printers .HPPrinter ;
3+ import com .iluwatar .delegation .simple .printers .App ;
64import org .junit .Test ;
75
86public class AppTest {
97
10- public static final String MESSAGE_TO_PRINT = "hello world" ;
8+ @ Test
9+ public void test () {
10+ String [] args = {};
11+ App .main (args );
12+ }
1113
12- @ Test
13- public void main () {
14- Printer hpPrinter = new HPPrinter ();
15- Printer canonPrinter = new CanonPrinter ();
16- Printer epsonPrinter = new EpsonPrinter ();
17-
18- PrinterController hpPrinterController = new PrinterController (hpPrinter );
19- PrinterController canonPrinterController = new PrinterController (canonPrinter );
20- PrinterController epsonPrinterController = new PrinterController (epsonPrinter );
21-
22- hpPrinterController .print (MESSAGE_TO_PRINT );
23- canonPrinterController .print (MESSAGE_TO_PRINT );
24- epsonPrinterController .print (MESSAGE_TO_PRINT );
25- }
2614}
You can’t perform that action at this time.
0 commit comments