📍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:
		| @@ -25,8 +25,7 @@ package com.iluwatar.tls; | ||||
|  | ||||
| import java.util.Calendar; | ||||
| import java.util.concurrent.Executors; | ||||
| import org.slf4j.Logger; | ||||
| import org.slf4j.LoggerFactory; | ||||
| import lombok.extern.slf4j.Slf4j; | ||||
|  | ||||
| /** | ||||
|  * ThreadLocal pattern | ||||
| @@ -58,10 +57,9 @@ import org.slf4j.LoggerFactory; | ||||
|  * | ||||
|  * @author Thomas Bauer, 2017 | ||||
|  */ | ||||
| @Slf4j | ||||
| public class App { | ||||
|  | ||||
|   private static final Logger LOGGER = LoggerFactory.getLogger(App.class); | ||||
|  | ||||
|   /** | ||||
|    * Program entry point. | ||||
|    * | ||||
|   | ||||
| @@ -27,8 +27,7 @@ import java.text.DateFormat; | ||||
| import java.text.SimpleDateFormat; | ||||
| import java.util.concurrent.Callable; | ||||
| import java.util.stream.IntStream; | ||||
| import org.slf4j.Logger; | ||||
| import org.slf4j.LoggerFactory; | ||||
| import lombok.extern.slf4j.Slf4j; | ||||
|  | ||||
| /** | ||||
|  * DateFormatCallable converts string dates to a date format using SimpleDateFormat. The date format | ||||
| @@ -42,9 +41,9 @@ import org.slf4j.LoggerFactory; | ||||
|  * | ||||
|  * @author Thomas Bauer, 2017 | ||||
|  */ | ||||
| @Slf4j | ||||
| public class DateFormatCallable implements Callable<Result> { | ||||
|  | ||||
|   private static final Logger LOGGER = LoggerFactory.getLogger(DateFormatCallable.class); | ||||
|   // class variables (members) | ||||
|   private final ThreadLocal<DateFormat> df;    //TLTL | ||||
|   // private DateFormat df;                 //NTLNTL | ||||
| @@ -86,7 +85,7 @@ public class DateFormatCallable implements Callable<Result> { | ||||
|       } | ||||
|     }); | ||||
|  | ||||
|     LOGGER.info(Thread.currentThread() + " finished processing part of the thread"); | ||||
|     LOGGER.info("{} finished processing part of the thread", Thread.currentThread()); | ||||
|  | ||||
|     return result; | ||||
|   } | ||||
|   | ||||
| @@ -122,7 +122,7 @@ public class DateFormatCallableTest { | ||||
|    * 15.12.2015 | ||||
|    */ | ||||
|   @Test | ||||
|   public void testDateValues() { | ||||
|   void testDateValues() { | ||||
|     assertEquals(expectedDateValues, createdDateValues); | ||||
|   } | ||||
|  | ||||
| @@ -131,7 +131,7 @@ public class DateFormatCallableTest { | ||||
|    * deliver 5 date values | ||||
|    */ | ||||
|   @Test | ||||
|   public void testCounterDateValues() { | ||||
|   void testCounterDateValues() { | ||||
|     assertEquals(expectedCounterDateValues, result.getDateList().size()); | ||||
|   } | ||||
|  | ||||
| @@ -140,7 +140,7 @@ public class DateFormatCallableTest { | ||||
|    * deliver no exceptions | ||||
|    */ | ||||
|   @Test | ||||
|   public void testCounterExceptions() { | ||||
|   void testCounterExceptions() { | ||||
|     assertEquals(expectedCounterExceptions, result.getExceptionList().size()); | ||||
|   } | ||||
| } | ||||
|   | ||||
| @@ -96,7 +96,7 @@ public class DateFormatCallableTestIncorrectDateFormat { | ||||
|    * same exception | ||||
|    */ | ||||
|   @Test | ||||
|   public void testExceptions() { | ||||
|   void testExceptions() { | ||||
|     assertEquals(expectedExceptions, result.getExceptionList()); | ||||
|   } | ||||
|  | ||||
| @@ -105,7 +105,7 @@ public class DateFormatCallableTestIncorrectDateFormat { | ||||
|    * deliver no date values | ||||
|    */ | ||||
|   @Test | ||||
|   public void testCounterDateValues() { | ||||
|   void testCounterDateValues() { | ||||
|     assertEquals(expectedCounterDateValues, result.getDateList().size()); | ||||
|   } | ||||
|  | ||||
| @@ -114,7 +114,7 @@ public class DateFormatCallableTestIncorrectDateFormat { | ||||
|    * deliver 5 exceptions | ||||
|    */ | ||||
|   @Test | ||||
|   public void testCounterExceptions() { | ||||
|   void testCounterExceptions() { | ||||
|     assertEquals(expectedCounterExceptions, result.getExceptionList().size()); | ||||
|   } | ||||
| } | ||||
|   | ||||
| @@ -134,7 +134,7 @@ public class DateFormatCallableTestMultiThread { | ||||
|    * 15.12.2015 by each thread | ||||
|    */ | ||||
|   @Test | ||||
|   public void testDateValues() { | ||||
|   void testDateValues() { | ||||
|     for (var createdDateValue : createdDateValues) { | ||||
|       assertEquals(expectedDateValues, createdDateValue); | ||||
|     } | ||||
| @@ -145,7 +145,7 @@ public class DateFormatCallableTestMultiThread { | ||||
|    * deliver 5 date values by each thread | ||||
|    */ | ||||
|   @Test | ||||
|   public void testCounterDateValues() { | ||||
|   void testCounterDateValues() { | ||||
|     for (var value : result) { | ||||
|       assertEquals(expectedCounterDateValues, value.getDateList().size()); | ||||
|     } | ||||
| @@ -156,7 +156,7 @@ public class DateFormatCallableTestMultiThread { | ||||
|    * deliver no exceptions | ||||
|    */ | ||||
|   @Test | ||||
|   public void testCounterExceptions() { | ||||
|   void testCounterExceptions() { | ||||
|     for (var value : result) { | ||||
|       assertEquals(expectedCounterExceptions, value.getExceptionList().size()); | ||||
|     } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user