Repository: logging-log4j2
Updated Branches:
  refs/heads/AutoCloseableLock 1fa5c9e6a -> 785e31edf


Add simple tests.

Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo
Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/785e31ed
Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/785e31ed
Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/785e31ed

Branch: refs/heads/AutoCloseableLock
Commit: 785e31edf92bc533915fdb68ef56d1d735782c28
Parents: 1fa5c9e
Author: Gary Gregory <[email protected]>
Authored: Fri Jun 24 08:08:32 2016 -0700
Committer: Gary Gregory <[email protected]>
Committed: Fri Jun 24 08:08:32 2016 -0700

----------------------------------------------------------------------
 .../log4j/util/AutoCloseableLockTest.java       | 24 +++++++++++++++++++-
 1 file changed, 23 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/785e31ed/log4j-api/src/test/java/org/apache/logging/log4j/util/AutoCloseableLockTest.java
----------------------------------------------------------------------
diff --git 
a/log4j-api/src/test/java/org/apache/logging/log4j/util/AutoCloseableLockTest.java
 
b/log4j-api/src/test/java/org/apache/logging/log4j/util/AutoCloseableLockTest.java
index dedd078..bac0594 100644
--- 
a/log4j-api/src/test/java/org/apache/logging/log4j/util/AutoCloseableLockTest.java
+++ 
b/log4j-api/src/test/java/org/apache/logging/log4j/util/AutoCloseableLockTest.java
@@ -16,16 +16,38 @@
  */
 package org.apache.logging.log4j.util;
 
+import org.junit.Before;
 import org.junit.Test;
 
 public class AutoCloseableLockTest {
 
+    private AutoCloseableLock lock;
+
+    @Before
+    public void setUp() {
+        lock = AutoCloseableLock.forReentrantLock();
+    }
+
     @Test(timeout = 100)
     public void testLockInTryWithResources() {
-        AutoCloseableLock lock = AutoCloseableLock.forReentrantLock();
         try (AutoCloseableLock l = lock.lock()) {
             // ...
         }
         lock.tryLock();
     }
+
+    @Test(timeout = 100)
+    public void testNewLockInTryWithResources() {
+        try (AutoCloseableLock l = AutoCloseableLock.forReentrantLock()) {
+            // ...
+        }
+    }
+
+    @Test(timeout = 100)
+    public void testNewLockWithTryWithResources() {
+        final AutoCloseableLock localLock = 
AutoCloseableLock.forReentrantLock();
+        try (AutoCloseableLock l = localLock) {
+            // ...
+        }
+    }
 }

Reply via email to