Skip to content

Commit 2394050

Browse files
authored
Add reset for explicitly set OS in test (#106)
1 parent cbfd2e5 commit 2394050

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

components/sbm-core/src/test/java/org/springframework/sbm/common/util/OsAgnosticPathMatcherTest.java

+15-1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@
1515
*/
1616
package org.springframework.sbm.common.util;
1717

18+
import org.junit.jupiter.api.AfterEach;
19+
import org.junit.jupiter.api.BeforeAll;
20+
import org.junit.jupiter.api.BeforeEach;
1821
import org.junit.jupiter.params.ParameterizedTest;
1922
import org.junit.jupiter.params.provider.CsvSource;
2023
import org.springframework.util.PathMatcher;
@@ -23,7 +26,18 @@
2326

2427
public class OsAgnosticPathMatcherTest {
2528

26-
private PathMatcher sut = new OsAgnosticPathMatcher();
29+
private final PathMatcher sut = new OsAgnosticPathMatcher();
30+
private String originalOsName;
31+
32+
@BeforeEach
33+
void beforeEach() {
34+
originalOsName = System.getProperty("os.name");
35+
}
36+
37+
@AfterEach
38+
void afterEach() {
39+
originalOsName = System.setProperty("os.name", originalOsName);
40+
}
2741

2842
@CsvSource({
2943
"Win, **/*Foo.txt, my\\win\\path\\SomeFoo.txt, true",

0 commit comments

Comments
 (0)