Search in sources :

Example 1 with HpPrinter

use of com.iluwatar.delegation.simple.printers.HpPrinter in project java-design-patterns by iluwatar.

the class App method main.

/**
 * Program entry point
 *
 * @param args command line args
 */
public static void main(String[] args) {
    PrinterController hpPrinterController = new PrinterController(new HpPrinter());
    PrinterController canonPrinterController = new PrinterController(new CanonPrinter());
    PrinterController epsonPrinterController = new PrinterController(new EpsonPrinter());
    hpPrinterController.print(MESSAGE_TO_PRINT);
    canonPrinterController.print(MESSAGE_TO_PRINT);
    epsonPrinterController.print(MESSAGE_TO_PRINT);
}
Also used : EpsonPrinter(com.iluwatar.delegation.simple.printers.EpsonPrinter) CanonPrinter(com.iluwatar.delegation.simple.printers.CanonPrinter) HpPrinter(com.iluwatar.delegation.simple.printers.HpPrinter)

Example 2 with HpPrinter

use of com.iluwatar.delegation.simple.printers.HpPrinter in project java-design-patterns by iluwatar.

the class DelegateTest method testHpPrinter.

@Test
public void testHpPrinter() throws Exception {
    PrinterController printerController = new PrinterController(new HpPrinter());
    printerController.print(MESSAGE);
    assertEquals("HP Printer : Test Message Printed", appender.getLastMessage());
}
Also used : HpPrinter(com.iluwatar.delegation.simple.printers.HpPrinter) Test(org.junit.jupiter.api.Test)

Aggregations

HpPrinter (com.iluwatar.delegation.simple.printers.HpPrinter)2 CanonPrinter (com.iluwatar.delegation.simple.printers.CanonPrinter)1 EpsonPrinter (com.iluwatar.delegation.simple.printers.EpsonPrinter)1 Test (org.junit.jupiter.api.Test)1