We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
See : stefanbirkner/system-rules#55
Sample changes :
Remove
import org.junit.Rule; import org.junit.contrib.java.lang.system.EnvironmentVariables; @Rule public final EnvironmentVariables envVars = new EnvironmentVariables();
Remove the dependency :
<dependency> <groupId>com.github.stefanbirkner</groupId> <artifactId>system-rules</artifactId> <scope>test</scope> </dependency>
It should add the dependency :
<dependency> <groupId>uk.org.webcompere</groupId> <artifactId>system-stubs-jupiter</artifactId> <scope>test</scope> </dependency>
It should also add the SystemStubsExtension at the class level
import uk.org.webcompere.systemstubs.jupiter.SystemStubsExtension; import uk.org.webcompere.systemstubs.environment.EnvironmentVariables; @ExtendWith(SystemStubsExtension.class) public class testClass { ... }
And add the environment as a parameter in the test
For example :
@Test public void testBefore() { envVars.set("var", "100"); } @Test public void testAfter(EnvironmentVariables envVars) { envVars.set("var", "100"); }
Sample diff :
import io.vertx.core.json.JsonObject; import io.vertx.junit5.VertxExtension; import io.vertx.junit5.VertxTestContext; -import org.junit.Rule; -import org.junit.contrib.java.lang.system.EnvironmentVariables; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; +import uk.org.webcompere.systemstubs.environment.EnvironmentVariables; +import uk.org.webcompere.systemstubs.jupiter.SystemStubsExtension; import java.io.IOException; @ExtendWith(VertxExtension.class) +@ExtendWith(SystemStubsExtension.class) public class AccountSegmentFunctionVerticleTest { - @Rule - public final EnvironmentVariables envVars = new EnvironmentVariables(); private final Vertx vertx; @@ -50,14 +47,14 @@ public class TestClass { } @Test - public void test(VertxTestContext testContext) { + public void test(VertxTestContext testContext,final EnvironmentVariables envVars) { envVars.set("var", "100");
The text was updated successfully, but these errors were encountered:
thanks @yeikel, this is very helpful
Sorry, something went wrong.
No branches or pull requests
See : stefanbirkner/system-rules#55
Sample changes :
Remove
Remove the dependency :
It should add the dependency :
It should also add the SystemStubsExtension at the class level
And add the environment as a parameter in the test
For example :
Sample diff :
The text was updated successfully, but these errors were encountered: