This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-lang.git

commit bc8a81eab022b4cfc363ee40bf1b306cc56c7ae3
Author: Gary Gregory <garydgreg...@gmail.com>
AuthorDate: Thu Oct 12 09:12:10 2023 -0400

    Add LazyInitializer tests
---
 ...Test.java => LazyInitializerAnonClassTest.java} | 35 +++++---------------
 ...zerTest.java => LazyInitializerSimpleTest.java} | 37 ++++++++-------------
 ...java => LazyInitializerSingleInstanceTest.java} | 38 ++++++++++------------
 3 files changed, 40 insertions(+), 70 deletions(-)

diff --git 
a/src/test/java/org/apache/commons/lang3/concurrent/LazyInitializerTest.java 
b/src/test/java/org/apache/commons/lang3/concurrent/LazyInitializerAnonClassTest.java
similarity index 51%
copy from 
src/test/java/org/apache/commons/lang3/concurrent/LazyInitializerTest.java
copy to 
src/test/java/org/apache/commons/lang3/concurrent/LazyInitializerAnonClassTest.java
index d9602b069..65d4373af 100644
--- a/src/test/java/org/apache/commons/lang3/concurrent/LazyInitializerTest.java
+++ 
b/src/test/java/org/apache/commons/lang3/concurrent/LazyInitializerAnonClassTest.java
@@ -16,41 +16,24 @@
  */
 package org.apache.commons.lang3.concurrent;
 
-import org.junit.jupiter.api.BeforeEach;
-
 /**
- * Test class for {@code LazyInitializer}.
+ * Tests {@code LazyInitializer}.
  */
-public class LazyInitializerTest extends AbstractConcurrentInitializerTest {
-    /** The initializer to be tested. */
-    private LazyInitializerTestImpl initializer;
-
-    @BeforeEach
-    public void setUp() {
-        initializer = new LazyInitializerTestImpl();
-    }
+public class LazyInitializerAnonClassTest extends 
AbstractConcurrentInitializerTest {
 
     /**
-     * Returns the initializer to be tested. This implementation returns the
-     * {@code LazyInitializer} created in the {@code setUp()} method.
+     * Creates the initializer to be tested. This implementation returns the 
{@code LazyInitializer} created in the {@code setUp()} method.
      *
      * @return the initializer to be tested
      */
     @Override
     protected ConcurrentInitializer<Object> createInitializer() {
-        return initializer;
+        return new LazyInitializer<Object>() {
+            @Override
+            protected Object initialize() {
+                return new Object();
+            }
+        };
     }
 
-    /**
-     * A test implementation of LazyInitializer. This class creates a plain
-     * Object. As Object does not provide a specific equals() method, it is 
easy
-     * to check whether multiple instances were created.
-     */
-    private static final class LazyInitializerTestImpl extends
-            LazyInitializer<Object> {
-        @Override
-        protected Object initialize() {
-            return new Object();
-        }
-    }
 }
diff --git 
a/src/test/java/org/apache/commons/lang3/concurrent/LazyInitializerTest.java 
b/src/test/java/org/apache/commons/lang3/concurrent/LazyInitializerSimpleTest.java
similarity index 60%
copy from 
src/test/java/org/apache/commons/lang3/concurrent/LazyInitializerTest.java
copy to 
src/test/java/org/apache/commons/lang3/concurrent/LazyInitializerSimpleTest.java
index d9602b069..904b72ffe 100644
--- a/src/test/java/org/apache/commons/lang3/concurrent/LazyInitializerTest.java
+++ 
b/src/test/java/org/apache/commons/lang3/concurrent/LazyInitializerSimpleTest.java
@@ -16,41 +16,30 @@
  */
 package org.apache.commons.lang3.concurrent;
 
-import org.junit.jupiter.api.BeforeEach;
-
 /**
- * Test class for {@code LazyInitializer}.
+ * Tests {@code LazyInitializer}.
  */
-public class LazyInitializerTest extends AbstractConcurrentInitializerTest {
-    /** The initializer to be tested. */
-    private LazyInitializerTestImpl initializer;
+public class LazyInitializerSimpleTest extends 
AbstractConcurrentInitializerTest {
 
-    @BeforeEach
-    public void setUp() {
-        initializer = new LazyInitializerTestImpl();
+    /**
+     * A test implementation of LazyInitializer. This class creates a plain 
Object. As Object does not provide a specific equals() method, it is easy to 
check
+     * whether multiple instances were created.
+     */
+    private static final class LazyInitializerTestImpl extends 
LazyInitializer<Object> {
+        @Override
+        protected Object initialize() {
+            return new Object();
+        }
     }
 
     /**
-     * Returns the initializer to be tested. This implementation returns the
-     * {@code LazyInitializer} created in the {@code setUp()} method.
+     * Creates the initializer to be tested. This implementation returns the 
{@code LazyInitializer} created in the {@code setUp()} method.
      *
      * @return the initializer to be tested
      */
     @Override
     protected ConcurrentInitializer<Object> createInitializer() {
-        return initializer;
+        return new LazyInitializerTestImpl();
     }
 
-    /**
-     * A test implementation of LazyInitializer. This class creates a plain
-     * Object. As Object does not provide a specific equals() method, it is 
easy
-     * to check whether multiple instances were created.
-     */
-    private static final class LazyInitializerTestImpl extends
-            LazyInitializer<Object> {
-        @Override
-        protected Object initialize() {
-            return new Object();
-        }
-    }
 }
diff --git 
a/src/test/java/org/apache/commons/lang3/concurrent/LazyInitializerTest.java 
b/src/test/java/org/apache/commons/lang3/concurrent/LazyInitializerSingleInstanceTest.java
similarity index 73%
rename from 
src/test/java/org/apache/commons/lang3/concurrent/LazyInitializerTest.java
rename to 
src/test/java/org/apache/commons/lang3/concurrent/LazyInitializerSingleInstanceTest.java
index d9602b069..cde1e91f3 100644
--- a/src/test/java/org/apache/commons/lang3/concurrent/LazyInitializerTest.java
+++ 
b/src/test/java/org/apache/commons/lang3/concurrent/LazyInitializerSingleInstanceTest.java
@@ -19,20 +19,26 @@ package org.apache.commons.lang3.concurrent;
 import org.junit.jupiter.api.BeforeEach;
 
 /**
- * Test class for {@code LazyInitializer}.
+ * Tests {@code LazyInitializer}.
  */
-public class LazyInitializerTest extends AbstractConcurrentInitializerTest {
-    /** The initializer to be tested. */
-    private LazyInitializerTestImpl initializer;
+public class LazyInitializerSingleInstanceTest extends 
AbstractConcurrentInitializerTest {
 
-    @BeforeEach
-    public void setUp() {
-        initializer = new LazyInitializerTestImpl();
+    /**
+     * A test implementation of LazyInitializer. This class creates a plain 
Object. As Object does not provide a specific equals() method, it is easy to 
check
+     * whether multiple instances were created.
+     */
+    private static final class LazyInitializerTestImpl extends 
LazyInitializer<Object> {
+        @Override
+        protected Object initialize() {
+            return new Object();
+        }
     }
 
+    /** The initializer to be tested. */
+    private LazyInitializerTestImpl initializer;
+
     /**
-     * Returns the initializer to be tested. This implementation returns the
-     * {@code LazyInitializer} created in the {@code setUp()} method.
+     * Creates the initializer to be tested. This implementation returns the 
{@code LazyInitializer} created in the {@code setUp()} method.
      *
      * @return the initializer to be tested
      */
@@ -41,16 +47,8 @@ public class LazyInitializerTest extends 
AbstractConcurrentInitializerTest {
         return initializer;
     }
 
-    /**
-     * A test implementation of LazyInitializer. This class creates a plain
-     * Object. As Object does not provide a specific equals() method, it is 
easy
-     * to check whether multiple instances were created.
-     */
-    private static final class LazyInitializerTestImpl extends
-            LazyInitializer<Object> {
-        @Override
-        protected Object initialize() {
-            return new Object();
-        }
+    @BeforeEach
+    public void setUp() {
+        initializer = new LazyInitializerTestImpl();
     }
 }

Reply via email to