Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
shedfreez committed Nov 20, 2024
1 parent 9ebc236 commit 6752f79
Showing 1 changed file with 9 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
import com.tencent.polaris.configuration.api.core.ConfigPropertyChangeInfo;
import org.assertj.core.api.Assertions;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;

Expand Down Expand Up @@ -67,7 +66,15 @@ public class ConfigChangeListenerTest {

@BeforeAll
public static void setUp() {
clearCompositePropertySourceCache();
try {
Class<?> clazz = PolarisConfigFileLocator.class;
Field field = clazz.getDeclaredField("compositePropertySourceCache");
field.setAccessible(true);
field.set(null, new CompositePropertySource("mock"));
}
catch (Exception e) {
// ignore
}
}

@Test
Expand Down Expand Up @@ -139,16 +146,4 @@ public void publishEvent(Object o) {
}
}
}

private static void clearCompositePropertySourceCache() {
try {
Class<?> clazz = PolarisConfigFileLocator.class;
Field field = clazz.getDeclaredField("compositePropertySourceCache");
field.setAccessible(true);
field.set(null, new CompositePropertySource("mock"));
}
catch (Exception e) {
// ignore
}
}
}

0 comments on commit 6752f79

Please sign in to comment.