📍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:
@ -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;
|
||||
|
@ -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";
|
||||
|
@ -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();
|
||||
|
Reference in New Issue
Block a user