You're Invited: Meet the Socket team at BSidesSF and RSAC - April 27 - May 1.RSVP
Socket
Sign inDemoInstall
Socket

com.github.brymck:with-environment

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

com.github.brymck:with-environment

Execute a block with overridden environment variables

0.9.1
Source
Maven
Version published
Maintainers
1
Source

with-environment

CircleCI codecov

with-environment is a library that allows overriding the system environment and executing a block.

Much of this is shamelessly yanked from SystemRules and is just designed to decouple the functionality from JUnit 4 and provide a natural Kotlin interface.

Usage

Include this in your POM:

<dependency>
  <groupId>com.github.brymck</groupId>
  <artifactId>with-environment</artifactId>
  <version>0.9.1</version>
</dependency>

And use it as so in Java:

Map<String, String> overrides = new HashMap();
overrides.put("FOO", "bar");
WithEnvironment.withEnvironmentOverrides(overrides, () -> {
  String foo = System.getenv("FOO");
  System.out.println(foo);  // prints "bar"
});

or Kotlin:

val overrides = mapOf("FOO" to "bar")
withEnvironmentOverrides(overrides) {
  val foo = System.getenv("FOO");
  println(foo)  // prints "bar"
}

FAQs

Package last updated on 26 Nov 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts