Skip to content

Commit

Permalink
Merge pull request #63 from webcompere/release-2.1.1
Browse files Browse the repository at this point in the history
Release 2.1.1
  • Loading branch information
ashleyfrieze authored Sep 6, 2023
2 parents dc308d0 + 5b41825 commit ccf09a0
Show file tree
Hide file tree
Showing 14 changed files with 48 additions and 18 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ System Stubs into JUnit 5 tests.
<dependency>
<groupId>uk.org.webcompere</groupId>
<artifactId>system-stubs-core</artifactId>
<version>2.1.0</version>
<version>2.1.1</version>
</dependency>
```

Expand All @@ -57,7 +57,7 @@ System Stubs into JUnit 5 tests.
<dependency>
<groupId>uk.org.webcompere</groupId>
<artifactId>system-stubs-junit4</artifactId>
<version>2.1.0</version>
<version>2.1.1</version>
</dependency>
```

Expand All @@ -67,7 +67,7 @@ System Stubs into JUnit 5 tests.
<dependency>
<groupId>uk.org.webcompere</groupId>
<artifactId>system-stubs-jupiter</artifactId>
<version>2.1.0</version>
<version>2.1.1</version>
</dependency>
```

Expand Down
8 changes: 4 additions & 4 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<groupId>uk.org.webcompere</groupId>
<artifactId>system-stubs-parent</artifactId>
<version>2.1.1-SNAPSHOT</version>
<version>2.1.2-SNAPSHOT</version>
<packaging>pom</packaging>

<name>System Stubs Parent</name>
Expand Down Expand Up @@ -32,7 +32,7 @@
<connection>scm:git:git://github.com/webcompere/system-stubs.git</connection>
<developerConnection>scm:git:git@github.com:webcompere/system-stubs.git</developerConnection>
<url>https://github.com/webcompere/system-stubs/</url>
<tag>system-stubs-parent-2.1.0</tag>
<tag>system-stubs-parent-2.1.1</tag>
</scm>

<modules>
Expand All @@ -59,13 +59,13 @@
<dependency>
<groupId>uk.org.webcompere</groupId>
<artifactId>system-stubs-interceptor</artifactId>
<version>2.1.1-SNAPSHOT</version>
<version>2.1.2-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>uk.org.webcompere</groupId>
<artifactId>system-stubs-core</artifactId>
<version>2.1.1-SNAPSHOT</version>
<version>2.1.2-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
Expand Down
4 changes: 2 additions & 2 deletions system-stubs-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
<parent>
<groupId>uk.org.webcompere</groupId>
<artifactId>system-stubs-parent</artifactId>
<version>2.1.1-SNAPSHOT</version>
<version>2.1.2-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

<artifactId>system-stubs-core</artifactId>
<version>2.1.1-SNAPSHOT</version>
<version>2.1.2-SNAPSHOT</version>
<packaging>jar</packaging>

<name>System Stubs Core</name>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -778,7 +778,7 @@ public static void withSecurityManager(SecurityManager securityManager,
* }
* </pre>
*
* <h3>Throwing Exceptions</h3>
* <b>Throwing Exceptions</b>
*
* <p>You can also simulate a {@code System.in} that throws an
* {@code IOException} or {@code RuntimeException}. Use
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@
* When something fails to load as part of a System Stubs operation
*/
public class LoadingException extends RuntimeException {
/**
* Construct the Loading exception
* @param message the message
* @param cause the root cause
*/
public LoadingException(String message, Throwable cause) {
super(message, cause);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@
public class DecoratingAltStream extends AltInputStream {
private InputStream decoratee;

/**
* Construct the stream with the decoratee
* @param decoratee the input stream that will be read from
*/
public DecoratingAltStream(InputStream decoratee) {
this.decoratee = decoratee;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ default void clear() {

/**
* When the target stream is meant to be closed, then close it
* @throws Exception on any error closing
*/
default void closeOutput() throws Exception {
// does nothing here
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ public static OutputFactory<MultiplexOutput> tapAndOutput() {

/**
* Write to file when the output is active, closing it when it's deactivated
* @param file the target file for writing to
*/
public static OutputFactory<FileOutputStream> writeToFile(File file) {
return original -> Output.fromCloseableStream(new FileOutputStream(file));
Expand Down
4 changes: 2 additions & 2 deletions system-stubs-interceptor/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
<parent>
<groupId>uk.org.webcompere</groupId>
<artifactId>system-stubs-parent</artifactId>
<version>2.1.1-SNAPSHOT</version>
<version>2.1.2-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

<artifactId>system-stubs-interceptor</artifactId>
<version>2.1.1-SNAPSHOT</version>
<version>2.1.2-SNAPSHOT</version>
<packaging>jar</packaging>

<name>System Stubs Interceptor</name>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,18 @@

import static java.util.stream.Collectors.toMap;

/**
* Plugs into the boot loader to provide an alternative implementation to ProcessEnvironment
* controllable at test time.
*/
public class ProcessEnvironmentInterceptor {
private static Map<String, String> CURRENT_ENVIRONMENT_VARIABLES = new HashMap<>();

/**
* For use by the EnvironmentMocker - this overwrites the effective environment variables that the system
* appears to have.
* @param env the environment variable map to use - this is kept by reference and so is mutable
*/
@SuppressFBWarnings("EI_EXPOSE_STATIC_REP2")
public static void setEnv(Map<String, String> env) {
CURRENT_ENVIRONMENT_VARIABLES = env;
Expand All @@ -23,10 +32,20 @@ public static Map<String, String> getenv() {
return filterNulls(CURRENT_ENVIRONMENT_VARIABLES);
}

/**
* Get a single environment variable
* @param name name of the variable
* @return the value or null
*/
public static String getenv(String name) {
return getenv().get(name);
}

/**
* Reads the environment variables as does getenv - a different part of
* ProcessEnvironment that we're stubbing
* @return the environment map
*/
public static Map<String, String> environment() {
return getenv();
}
Expand Down
2 changes: 1 addition & 1 deletion system-stubs-junit4/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ project and has been rebuilt from the ground up for this version.
<dependency>
<groupId>uk.org.webcompere</groupId>
<artifactId>system-stubs-junit4</artifactId>
<version>2.1.0</version>
<version>2.1.1</version>
</dependency>
```

Expand Down
4 changes: 2 additions & 2 deletions system-stubs-junit4/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
<parent>
<groupId>uk.org.webcompere</groupId>
<artifactId>system-stubs-parent</artifactId>
<version>2.1.1-SNAPSHOT</version>
<version>2.1.2-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

<artifactId>system-stubs-junit4</artifactId>
<version>2.1.1-SNAPSHOT</version>
<version>2.1.2-SNAPSHOT</version>
<packaging>jar</packaging>

<name>System Stubs JUnit4</name>
Expand Down
2 changes: 1 addition & 1 deletion system-stubs-jupiter/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ JUnit 5 unit test.
<dependency>
<groupId>uk.org.webcompere</groupId>
<artifactId>system-stubs-jupiter</artifactId>
<version>2.1.0</version>
<version>2.1.1</version>
</dependency>
```

Expand Down
4 changes: 2 additions & 2 deletions system-stubs-jupiter/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
<parent>
<groupId>uk.org.webcompere</groupId>
<artifactId>system-stubs-parent</artifactId>
<version>2.1.1-SNAPSHOT</version>
<version>2.1.2-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

<artifactId>system-stubs-jupiter</artifactId>
<version>2.1.1-SNAPSHOT</version>
<version>2.1.2-SNAPSHOT</version>
<packaging>jar</packaging>

<name>System Stubs Jupiter</name>
Expand Down

0 comments on commit ccf09a0

Please sign in to comment.