-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #68 from webcompere/interoperability-with-other-li…
…braries Provide backwards compatibility for tools that should be able to mock the environment
- Loading branch information
Showing
5 changed files
with
67 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
...bcompere/systemstubs/jupiter/compatibility/DoesNotPreventJUnitPioneerFromWorkingTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package uk.org.webcompere.systemstubs.jupiter.compatibility; | ||
|
||
import org.junit.jupiter.api.Nested; | ||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.condition.EnabledForJreRange; | ||
import org.junit.jupiter.api.condition.JRE; | ||
import org.junit.jupiter.api.extension.ExtendWith; | ||
import org.junitpioneer.jupiter.SetEnvironmentVariable; | ||
import uk.org.webcompere.systemstubs.environment.EnvironmentVariables; | ||
import uk.org.webcompere.systemstubs.jupiter.SystemStub; | ||
import uk.org.webcompere.systemstubs.jupiter.SystemStubsExtension; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
|
||
@EnabledForJreRange(max = JRE.JAVA_16) | ||
class DoesNotPreventJUnitPioneerFromWorkingTest { | ||
|
||
@Nested | ||
@ExtendWith(SystemStubsExtension.class) | ||
static class StubsWorks { | ||
@SystemStub | ||
private EnvironmentVariables variables; | ||
|
||
@Test | ||
void canStubVariable() { | ||
variables.set("MACHINE", "hot"); | ||
|
||
assertThat(System.getenv("MACHINE")).isEqualTo("hot"); | ||
} | ||
} | ||
|
||
@Nested | ||
@SetEnvironmentVariable(key="MACHINE", value="COLD") | ||
static class PioneerWorks { | ||
@Test | ||
void canPioneerVariable() { | ||
assertThat(System.getenv("MACHINE")).isEqualTo("cold"); | ||
} | ||
} | ||
|
||
} |