📍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

@ -23,8 +23,7 @@
package com.iluwatar.composite;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import lombok.extern.slf4j.Slf4j;
/**
* The Composite pattern is a partitioning design pattern. The Composite pattern describes that a
@ -35,15 +34,14 @@ import org.slf4j.LoggerFactory;
*
* <p>In this example we have sentences composed of words composed of letters. All of the objects
* can be treated through the same interface ({@link LetterComposite}).
*
*
*/
@Slf4j
public class App {
private static final Logger LOGGER = LoggerFactory.getLogger(App.class);
/**
* Program entry point.
*
*
* @param args command line args
*/
public static void main(String[] args) {

View File

@ -23,17 +23,16 @@
package com.iluwatar.composite;
import lombok.RequiredArgsConstructor;
/**
* Letter.
*/
@RequiredArgsConstructor
public class Letter extends LetterComposite {
private final char character;
public Letter(char c) {
this.character = c;
}
@Override
protected void printThisBefore() {
System.out.print(character);

View File

@ -23,22 +23,21 @@
package com.iluwatar.composite;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import java.io.ByteArrayOutputStream;
import java.io.PrintStream;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
/**
* Date: 12/11/15 - 8:12 PM
*
* @author Jeroen Meulemeester
*/
public class MessengerTest {
class MessengerTest {
/**
* The buffer used to capture every write to {@link System#out}
@ -54,7 +53,7 @@ public class MessengerTest {
* Inject the mocked std-out {@link PrintStream} into the {@link System} class before each test
*/
@BeforeEach
public void setUp() {
void setUp() {
this.stdOutBuffer = new ByteArrayOutputStream();
System.setOut(new PrintStream(stdOutBuffer));
}
@ -63,7 +62,7 @@ public class MessengerTest {
* Removed the mocked std-out {@link PrintStream} again from the {@link System} class
*/
@AfterEach
public void tearDown() {
void tearDown() {
System.setOut(realStdOut);
}
@ -71,7 +70,7 @@ public class MessengerTest {
* Test the message from the orcs
*/
@Test
public void testMessageFromOrcs() {
void testMessageFromOrcs() {
final var messenger = new Messenger();
testMessage(
messenger.messageFromOrcs(),
@ -83,7 +82,7 @@ public class MessengerTest {
* Test the message from the elves
*/
@Test
public void testMessageFromElves() {
void testMessageFromElves() {
final var messenger = new Messenger();
testMessage(
messenger.messageFromElves(),