📍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:
		@@ -23,8 +23,7 @@
 | 
			
		||||
 | 
			
		||||
package com.iluwatar.object.pool;
 | 
			
		||||
 | 
			
		||||
import org.slf4j.Logger;
 | 
			
		||||
import org.slf4j.LoggerFactory;
 | 
			
		||||
import lombok.extern.slf4j.Slf4j;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * When it is necessary to work with a large number of objects that are particularly expensive to
 | 
			
		||||
@@ -44,10 +43,9 @@ import org.slf4j.LoggerFactory;
 | 
			
		||||
 * ObjectPool}. {@link Oliphaunt}s can be checked out from the pool and later returned to it. The
 | 
			
		||||
 * pool tracks created instances and their status (available, inUse).
 | 
			
		||||
 */
 | 
			
		||||
@Slf4j
 | 
			
		||||
public class App {
 | 
			
		||||
 | 
			
		||||
  private static final Logger LOGGER = LoggerFactory.getLogger(App.class);
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * Program entry point.
 | 
			
		||||
   *
 | 
			
		||||
 
 | 
			
		||||
@@ -26,7 +26,7 @@ package com.iluwatar.object.pool;
 | 
			
		||||
import org.junit.jupiter.api.Test;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * 
 | 
			
		||||
 *
 | 
			
		||||
 * Application test
 | 
			
		||||
 *
 | 
			
		||||
 */
 | 
			
		||||
 
 | 
			
		||||
@@ -23,26 +23,29 @@
 | 
			
		||||
 | 
			
		||||
package com.iluwatar.object.pool;
 | 
			
		||||
 | 
			
		||||
import org.junit.jupiter.api.Test;
 | 
			
		||||
import static java.time.Duration.ofMillis;
 | 
			
		||||
import static org.junit.jupiter.api.Assertions.assertEquals;
 | 
			
		||||
import static org.junit.jupiter.api.Assertions.assertNotSame;
 | 
			
		||||
import static org.junit.jupiter.api.Assertions.assertSame;
 | 
			
		||||
import static org.junit.jupiter.api.Assertions.assertTimeout;
 | 
			
		||||
import static org.junit.jupiter.api.Assertions.assertTrue;
 | 
			
		||||
 | 
			
		||||
import java.util.List;
 | 
			
		||||
 | 
			
		||||
import static java.time.Duration.ofMillis;
 | 
			
		||||
import static org.junit.jupiter.api.Assertions.*;
 | 
			
		||||
import org.junit.jupiter.api.Test;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Date: 12/27/15 - 1:05 AM
 | 
			
		||||
 *
 | 
			
		||||
 * @author Jeroen Meulemeester
 | 
			
		||||
 */
 | 
			
		||||
public class OliphauntPoolTest {
 | 
			
		||||
class OliphauntPoolTest {
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * Use the same object 100 times subsequently. This should not take much time since the heavy
 | 
			
		||||
   * object instantiation is done only once. Verify if we get the same object each time.
 | 
			
		||||
   */
 | 
			
		||||
  @Test
 | 
			
		||||
  public void testSubsequentCheckinCheckout() {
 | 
			
		||||
  void testSubsequentCheckinCheckout() {
 | 
			
		||||
    assertTimeout(ofMillis(5000), () -> {
 | 
			
		||||
      final var pool = new OliphauntPool();
 | 
			
		||||
      assertEquals("Pool available=0 inUse=0", pool.toString());
 | 
			
		||||
@@ -71,7 +74,7 @@ public class OliphauntPoolTest {
 | 
			
		||||
   * object instantiation is done only once. Verify if we get the same object each time.
 | 
			
		||||
   */
 | 
			
		||||
  @Test
 | 
			
		||||
  public void testConcurrentCheckinCheckout() {
 | 
			
		||||
  void testConcurrentCheckinCheckout() {
 | 
			
		||||
    assertTimeout(ofMillis(5000), () -> {
 | 
			
		||||
      final var pool = new OliphauntPool();
 | 
			
		||||
      assertEquals(pool.toString(), "Pool available=0 inUse=0");
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user