You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@logging.apache.org by ma...@apache.org on 2024/01/02 01:55:35 UTC

(logging-log4j2) branch main updated: Use some new syntax

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

mattsicker pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/logging-log4j2.git


The following commit(s) were added to refs/heads/main by this push:
     new 9f6a4305e4 Use some new syntax
9f6a4305e4 is described below

commit 9f6a4305e4815b6e228b746ac4c12f26ab862da0
Author: Matt Sicker <ma...@apache.org>
AuthorDate: Mon Jan 1 19:52:51 2024 -0600

    Use some new syntax
    
    Signed-off-by: Matt Sicker <ma...@apache.org>
---
 .../org/apache/logging/log4j/test/junit/TestPropertySource.java  | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/log4j-api-test/src/main/java/org/apache/logging/log4j/test/junit/TestPropertySource.java b/log4j-api-test/src/main/java/org/apache/logging/log4j/test/junit/TestPropertySource.java
index c6057223ba..ea89c19f17 100644
--- a/log4j-api-test/src/main/java/org/apache/logging/log4j/test/junit/TestPropertySource.java
+++ b/log4j-api-test/src/main/java/org/apache/logging/log4j/test/junit/TestPropertySource.java
@@ -35,12 +35,11 @@ public class TestPropertySource implements PropertySource {
     }
 
     public static TestProperties createProperties(final ExtensionContext context) {
-        TestProperties props = getProperties(context);
         // Make sure that the properties do not come from the parent ExtensionContext
-        if (props instanceof JUnitTestProperties && context.equals(((JUnitTestProperties) props).getContext())) {
+        if (getProperties(context) instanceof JUnitTestProperties props && context.equals(props.context)) {
             return props;
         }
-        props = new JUnitTestProperties(context);
+        final TestProperties props = new JUnitTestProperties(context);
         ExtensionContextAnchor.setAttribute(TestProperties.class, props, context);
         return props;
     }
@@ -88,10 +87,6 @@ public class TestPropertySource implements PropertySource {
             this.store = context.getStore(NAMESPACE);
         }
 
-        public ExtensionContext getContext() {
-            return context;
-        }
-
         @Override
         public String getProperty(final String key) {
             return store.get(key, String.class);