Repository: logging-log4j2 Updated Branches: refs/heads/AutoCloseableLock 31c502365 -> 1fa5c9e6a
Add a simple test. Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/1fa5c9e6 Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/1fa5c9e6 Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/1fa5c9e6 Branch: refs/heads/AutoCloseableLock Commit: 1fa5c9e6af8295009d88e5356bb2570841442fdf Parents: 31c5023 Author: Gary Gregory <[email protected]> Authored: Fri Jun 24 08:04:41 2016 -0700 Committer: Gary Gregory <[email protected]> Committed: Fri Jun 24 08:04:41 2016 -0700 ---------------------------------------------------------------------- .../log4j/util/AutoCloseableLockTest.java | 31 ++++++++++++++++++++ 1 file changed, 31 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/1fa5c9e6/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 new file mode 100644 index 0000000..dedd078 --- /dev/null +++ b/log4j-api/src/test/java/org/apache/logging/log4j/util/AutoCloseableLockTest.java @@ -0,0 +1,31 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache license, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the license for the specific language governing permissions and + * limitations under the license. + */ +package org.apache.logging.log4j.util; + +import org.junit.Test; + +public class AutoCloseableLockTest { + + @Test(timeout = 100) + public void testLockInTryWithResources() { + AutoCloseableLock lock = AutoCloseableLock.forReentrantLock(); + try (AutoCloseableLock l = lock.lock()) { + // ... + } + lock.tryLock(); + } +}
