Skip to content

Commit

Permalink
fix: com.github.stefanbirkner:system-rule test does not work with Jav…
Browse files Browse the repository at this point in the history
…a 16
  • Loading branch information
lanxenet committed Sep 13, 2023
1 parent 082d65d commit 7743f8d
Showing 1 changed file with 10 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,7 @@

package com.megaease.easeagent.config;

import org.junit.Assert;
import org.junit.Rule;
import org.junit.Test;
import org.junit.*;
import org.junit.contrib.java.lang.system.EnvironmentVariables;
import org.junit.contrib.java.lang.system.RestoreSystemProperties;

Expand All @@ -33,6 +31,15 @@ public class ConfigPropertiesUtilsTest {
public final RestoreSystemProperties restoreSystemProperties
= new RestoreSystemProperties();

@BeforeClass
public static void beforeClass() {
// EnvironmentVariables and restoreSystemProperties does not work with Java 16
Assume.assumeTrue(
System.getProperty("java.version").startsWith("1.8")
|| System.getProperty("java.version").startsWith("11")
);
}

@Test
public void getString_systemProperty() {
environmentVariables.set("TEST_PROPERTY_STRING", "env");
Expand Down

0 comments on commit 7743f8d

Please sign in to comment.