1717import org .junit .jupiter .api .Test ;
1818import org .junit .jupiter .api .extension .ExtendWith ;
1919import org .junit .jupiter .api .io .TempDir ;
20- import org .junitpioneer .jupiter .ClearSystemProperty ;
2120import uk .org .webcompere .systemstubs .environment .EnvironmentVariables ;
2221import uk .org .webcompere .systemstubs .jupiter .SystemStub ;
2322import uk .org .webcompere .systemstubs .jupiter .SystemStubsExtension ;
23+ import uk .org .webcompere .systemstubs .properties .SystemProperties ;
2424
2525@ ExtendWith (SystemStubsExtension .class )
26- @ ClearSystemProperty (key = "otel.javaagent.configuration-file" )
2726class ConfigurationFileTest {
2827
2928 @ TempDir File tmpDir ;
3029
3130 @ SystemStub private EnvironmentVariables environmentVariables ;
3231
33- // @SystemStub private SystemProperties systemProperties;
32+ @ SystemStub private SystemProperties systemProperties ;
3433
3534 @ Test
3635 void shouldUseEnvVar () throws IOException {
@@ -45,7 +44,7 @@ void shouldUseEnvVar() throws IOException {
4544 @ Test
4645 void shouldUseSystemProperty () throws IOException {
4746 String path = createFile ("config" , "property1=val-sys" );
48- System . setProperty ("otel.javaagent.configuration-file" , path );
47+ systemProperties . set ("otel.javaagent.configuration-file" , path );
4948
5049 Map <String , String > properties = ConfigurationFile .loadConfigFile ();
5150
@@ -56,7 +55,7 @@ void shouldUseSystemProperty() throws IOException {
5655 void shouldUseSystemPropertyOverEnvVar () throws IOException {
5756 String pathEnv = createFile ("configEnv" , "property1=val-env" );
5857 String path = createFile ("config" , "property1=val-sys" );
59- System . setProperty ("otel.javaagent.configuration-file" , path );
58+ systemProperties . set ("otel.javaagent.configuration-file" , path );
6059 environmentVariables .set ("OTEL_JAVAAGENT_CONFIGURATION_FILE" , pathEnv );
6160
6261 Map <String , String > properties = ConfigurationFile .loadConfigFile ();
@@ -66,7 +65,7 @@ void shouldUseSystemPropertyOverEnvVar() throws IOException {
6665
6766 @ Test
6867 void shouldReturnEmptyPropertiesIfFileDoesNotExist () {
69- System . setProperty ("otel.javaagent.configuration-file" , "somePath" );
68+ systemProperties . set ("otel.javaagent.configuration-file" , "somePath" );
7069
7170 Map <String , String > properties = ConfigurationFile .loadConfigFile ();
7271
0 commit comments