Fix CheckStyle #324

This commit is contained in:
Joseph McCarthy 2015-12-28 20:34:28 +00:00
parent fcadb223ce
commit 0bc722f797
8 changed files with 93 additions and 91 deletions

View File

@ -2,8 +2,8 @@ package com.iluwatar.delegation.simple;
/** /**
* Extra layer of abstraction for the controller to allow the controller in this example {@link PrinterController} to * Extra layer of abstraction for the controller to allow the controller in this example {@link PrinterController} to
* be as clean as possible. This just provides the default constructor and a simple getter method. The generic of T allows * be as clean as possible. This just provides the default constructor and a simple getter method. The generic of
* any implementation of {@link Printer} * T allows any implementation of {@link Printer}
* *
* @param <T> Printer * @param <T> Printer
* @see Printer * @see Printer

View File

@ -2,14 +2,14 @@ package com.iluwatar.delegation.simple;
import com.iluwatar.delegation.simple.printers.CanonPrinter; import com.iluwatar.delegation.simple.printers.CanonPrinter;
import com.iluwatar.delegation.simple.printers.EpsonPrinter; import com.iluwatar.delegation.simple.printers.EpsonPrinter;
import com.iluwatar.delegation.simple.printers.HPPrinter; import com.iluwatar.delegation.simple.printers.HpPrinter;
/** /**
* In this example the delegates are {@link EpsonPrinter}, {@link HPPrinter} and {@link CanonPrinter} they all implement * In this example the delegates are {@link EpsonPrinter}, {@link HpPrinter} and {@link CanonPrinter} they all implement
* {@link Printer}. The {@link AbstractPrinterController} and through inheritance {@link PrinterController} also implement * {@link Printer}. The {@link AbstractPrinterController} and through inheritance {@link PrinterController} also
* {@link Printer}. However neither provide the functionality of {@link Printer} by printing to the screen, they actually * implement {@link Printer}. However neither provide the functionality of {@link Printer} by printing to the screen,
* call upon the instance of {@link Printer} that they were instantiated with. Therefore delegating the behaviour to * they actually call upon the instance of {@link Printer} that they were instantiated with. Therefore delegating the
* another class. * behaviour to another class.
*/ */
public class App { public class App {
@ -21,7 +21,7 @@ public class App {
* @param args command line args * @param args command line args
*/ */
public static void main(String[] args) { public static void main(String[] args) {
AbstractPrinterController hpPrinterController = new PrinterController(new HPPrinter()); AbstractPrinterController hpPrinterController = new PrinterController(new HpPrinter());
AbstractPrinterController canonPrinterController = new PrinterController(new CanonPrinter()); AbstractPrinterController canonPrinterController = new PrinterController(new CanonPrinter());
AbstractPrinterController epsonPrinterController = new PrinterController(new EpsonPrinter()); AbstractPrinterController epsonPrinterController = new PrinterController(new EpsonPrinter());

View File

@ -1,11 +1,13 @@
package com.iluwatar.delegation.simple; package com.iluwatar.delegation.simple;
import com.iluwatar.delegation.simple.printers.HpPrinter;
/** /**
* Interface that both the Controller and the Delegate will implement. * Interface that both the Controller and the Delegate will implement.
* *
* @see com.iluwatar.delegation.simple.printers.CanonPrinter * @see com.iluwatar.delegation.simple.printers.CanonPrinter
* @see com.iluwatar.delegation.simple.printers.EpsonPrinter * @see com.iluwatar.delegation.simple.printers.EpsonPrinter
* @see com.iluwatar.delegation.simple.printers.HPPrinter * @see HpPrinter
* @see AbstractPrinterController * @see AbstractPrinterController
*/ */
public interface Printer { public interface Printer {

View File

@ -8,7 +8,7 @@ import com.iluwatar.delegation.simple.Printer;
* *
* @see Printer * @see Printer
*/ */
public class EpsonPrinter implements Printer{ public class EpsonPrinter implements Printer {
/** /**
* {@inheritDoc} * {@inheritDoc}

View File

@ -8,7 +8,7 @@ import com.iluwatar.delegation.simple.Printer;
* *
* @see Printer * @see Printer
*/ */
public class HPPrinter implements Printer { public class HpPrinter implements Printer {
/** /**
* {@inheritDoc} * {@inheritDoc}

View File

@ -2,7 +2,7 @@ package com.iluwatar.delegation.simple;
import com.iluwatar.delegation.simple.printers.CanonPrinter; import com.iluwatar.delegation.simple.printers.CanonPrinter;
import com.iluwatar.delegation.simple.printers.EpsonPrinter; import com.iluwatar.delegation.simple.printers.EpsonPrinter;
import com.iluwatar.delegation.simple.printers.HPPrinter; import com.iluwatar.delegation.simple.printers.HpPrinter;
import org.junit.Rule; import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
import org.junit.contrib.java.lang.system.SystemOutRule; import org.junit.contrib.java.lang.system.SystemOutRule;
@ -26,7 +26,7 @@ public class DelegateTest {
@Test @Test
public void testHPPrinter() throws Exception { public void testHPPrinter() throws Exception {
AbstractPrinterController abstractController = new PrinterController(new HPPrinter()); AbstractPrinterController abstractController = new PrinterController(new HpPrinter());
abstractController.print(MESSAGE); abstractController.print(MESSAGE);
assertEquals("HP Printer : Test Message Printed\n", systemOutRule.getLog()); assertEquals("HP Printer : Test Message Printed\n", systemOutRule.getLog());