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

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

commit 8796ae582de28d056fba1aa0fb5531d07b8dd361
Author: ulrichenslin <[email protected]>
AuthorDate: Sat Mar 2 08:47:43 2019 +0200

    Test for JEP223 detection
---
 .../log4j/core/layout/AbstractStringLayoutTest.java  | 20 ++++++++++++++------
 1 file changed, 14 insertions(+), 6 deletions(-)

diff --git 
a/log4j-core/src/test/java/org/apache/logging/log4j/core/layout/AbstractStringLayoutTest.java
 
b/log4j-core/src/test/java/org/apache/logging/log4j/core/layout/AbstractStringLayoutTest.java
index f0b3d69..9dce991 100644
--- 
a/log4j-core/src/test/java/org/apache/logging/log4j/core/layout/AbstractStringLayoutTest.java
+++ 
b/log4j-core/src/test/java/org/apache/logging/log4j/core/layout/AbstractStringLayoutTest.java
@@ -81,18 +81,26 @@ public class AbstractStringLayoutTest {
     @Test
     public void testJdkVersionDetection() throws NoSuchMethodException, 
InvocationTargetException, IllegalAccessException {
 
-        Properties properties120 = new Properties();
-        properties120.put("java.version","1.2.0");
-        System.setProperties(properties120);
+        final String currentVersion = System.getProperty("java.version");
+
+        Properties properties = new Properties();
+        properties.put("java.version","1.2.0");
+        System.setProperties(properties);
 
         Method method = 
AbstractStringLayout.class.getDeclaredMethod("isPreJava8",null);
         method.setAccessible(true);
         assertTrue ((Boolean) method.invoke("isPreJava8"));
 
-        Properties properties900 = new Properties();
-        properties120.put("java.version","9.1.0");
-        System.setProperties(properties120);
+        properties = new Properties();
+        properties.put("java.version","9.1.0");
+        System.setProperties(properties);
 
         assertFalse ((Boolean) method.invoke("isPreJava8"));
+
+        //reset the value to the current version
+        properties = new Properties();
+        properties.put("java.version", currentVersion);
+        System.setProperties(properties);
+
     }
 }
\ No newline at end of file

Reply via email to