📍Use lombok, reformat, and optimize the code (#1560)

* Use lombok, reformat, and optimize the code

* Fix merge conflicts and some sonar issues

Co-authored-by: va1m <va1m@email.com>
This commit is contained in:
va1m
2021-03-13 13:19:21 +01:00
committed by GitHub
parent 0e26a6adb5
commit 5cf2fe009b
681 changed files with 2472 additions and 4966 deletions

View File

@ -24,8 +24,7 @@
package com.iluwatar.delegation.simple.printers;
import com.iluwatar.delegation.simple.Printer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import lombok.extern.slf4j.Slf4j;
/**
* Specialised Implementation of {@link Printer} for a Canon Printer, in this case the message to be
@ -33,10 +32,9 @@ import org.slf4j.LoggerFactory;
*
* @see Printer
*/
@Slf4j
public class CanonPrinter implements Printer {
private static final Logger LOGGER = LoggerFactory.getLogger(CanonPrinter.class);
/**
* {@inheritDoc}
*/

View File

@ -24,8 +24,7 @@
package com.iluwatar.delegation.simple.printers;
import com.iluwatar.delegation.simple.Printer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import lombok.extern.slf4j.Slf4j;
/**
* Specialised Implementation of {@link Printer} for a Epson Printer, in this case the message to be
@ -33,10 +32,9 @@ import org.slf4j.LoggerFactory;
*
* @see Printer
*/
@Slf4j
public class EpsonPrinter implements Printer {
private static final Logger LOGGER = LoggerFactory.getLogger(EpsonPrinter.class);
/**
* {@inheritDoc}
*/

View File

@ -24,8 +24,7 @@
package com.iluwatar.delegation.simple.printers;
import com.iluwatar.delegation.simple.Printer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import lombok.extern.slf4j.Slf4j;
/**
* Specialised Implementation of {@link Printer} for a HP Printer, in this case the message to be
@ -33,10 +32,9 @@ import org.slf4j.LoggerFactory;
*
* @see Printer
*/
@Slf4j
public class HpPrinter implements Printer {
private static final Logger LOGGER = LoggerFactory.getLogger(HpPrinter.class);
/**
* {@inheritDoc}
*/

View File

@ -41,24 +41,24 @@ import org.slf4j.LoggerFactory;
/**
* Test for Delegation Pattern
*/
public class DelegateTest {
class DelegateTest {
private InMemoryAppender appender;
@BeforeEach
public void setUp() {
void setUp() {
appender = new InMemoryAppender();
}
@AfterEach
public void tearDown() {
void tearDown() {
appender.stop();
}
private static final String MESSAGE = "Test Message Printed";
@Test
public void testCanonPrinter() throws Exception {
void testCanonPrinter() throws Exception {
var printerController = new PrinterController(new CanonPrinter());
printerController.print(MESSAGE);
@ -66,7 +66,7 @@ public class DelegateTest {
}
@Test
public void testHpPrinter() throws Exception {
void testHpPrinter() throws Exception {
var printerController = new PrinterController(new HpPrinter());
printerController.print(MESSAGE);
@ -74,7 +74,7 @@ public class DelegateTest {
}
@Test
public void testEpsonPrinter() throws Exception {
void testEpsonPrinter() throws Exception {
var printerController = new PrinterController(new EpsonPrinter());
printerController.print(MESSAGE);
@ -84,7 +84,7 @@ public class DelegateTest {
/**
* Logging Appender
*/
private class InMemoryAppender extends AppenderBase<ILoggingEvent> {
private static class InMemoryAppender extends AppenderBase<ILoggingEvent> {
private final List<ILoggingEvent> log = new LinkedList<>();