📍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.module;
import java.io.PrintStream;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import lombok.extern.slf4j.Slf4j;
/**
* The ConsoleLoggerModule is responsible for showing logs on System Console.
@ -33,10 +32,9 @@ import org.slf4j.LoggerFactory;
* <p>The below example demonstrates a Console logger module, which can print simple and error
* messages in two designated formats
*/
@Slf4j
public final class ConsoleLoggerModule {
private static final Logger LOGGER = LoggerFactory.getLogger(ConsoleLoggerModule.class);
private static ConsoleLoggerModule singleton = null;
public PrintStream output = null;

View File

@ -26,8 +26,7 @@ package com.iluwatar.module;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.PrintStream;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import lombok.extern.slf4j.Slf4j;
/**
* The FileLoggerModule is responsible for showing logs on File System.
@ -35,10 +34,9 @@ import org.slf4j.LoggerFactory;
* <p>The below example demonstrates a File logger module, which can print simple and error
* messages in two designated files
*/
@Slf4j
public final class FileLoggerModule {
private static final Logger LOGGER = LoggerFactory.getLogger(FileLoggerModule.class);
private static FileLoggerModule singleton = null;
private static final String OUTPUT_FILE = "output.txt";

View File

@ -30,9 +30,8 @@ import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import lombok.extern.slf4j.Slf4j;
import org.junit.jupiter.api.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* The Module pattern can be considered a Creational pattern and a Structural pattern. It manages
@ -44,10 +43,9 @@ import org.slf4j.LoggerFactory;
* The below example demonstrates a JUnit test for testing two different modules: File Logger and
* Console Logger
*/
@Slf4j
public final class FileLoggerModuleTest {
private static final Logger LOGGER = LoggerFactory.getLogger(FileLoggerModuleTest.class);
private static final String OUTPUT_FILE = "output.txt";
private static final String ERROR_FILE = "error.txt";
@ -61,7 +59,7 @@ public final class FileLoggerModuleTest {
* @throws IOException if program is not able to find log files (output.txt and error.txt)
*/
@Test
public void testFileMessage() throws IOException {
void testFileMessage() throws IOException {
/* Get singleton instance of File Logger Module */
final var fileLoggerModule = FileLoggerModule.getSingleton();
@ -85,7 +83,7 @@ public final class FileLoggerModuleTest {
* @throws IOException if program is not able to find log files (output.txt and error.txt)
*/
@Test
public void testNoFileMessage() throws IOException {
void testNoFileMessage() throws IOException {
/* Get singleton instance of File Logger Module */
final var fileLoggerModule = FileLoggerModule.getSingleton();
@ -107,7 +105,7 @@ public final class FileLoggerModuleTest {
* error.txt)
*/
@Test
public void testFileErrorMessage() throws FileNotFoundException {
void testFileErrorMessage() throws FileNotFoundException {
/* Get singleton instance of File Logger Module */
final var fileLoggerModule = FileLoggerModule.getSingleton();
@ -132,7 +130,7 @@ public final class FileLoggerModuleTest {
* error.txt)
*/
@Test
public void testNoFileErrorMessage() throws FileNotFoundException {
void testNoFileErrorMessage() throws FileNotFoundException {
/* Get singleton instance of File Logger Module */
final var fileLoggerModule = FileLoggerModule.getSingleton();