Search in sources :

Example 1 with CanonPrinter

use of com.iluwatar.delegation.simple.printers.CanonPrinter 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 CanonPrinter

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

the class DelegateTest method testCanonPrinter.

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

Aggregations

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