Skip to content

Commit c9c10fe

Browse files
committed
Javadoc tweaks
1 parent 81dcbdd commit c9c10fe

File tree

6 files changed

+31
-1
lines changed

6 files changed

+31
-1
lines changed

system-stubs-core/src/main/java/uk/org/webcompere/systemstubs/SystemStubs.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -778,7 +778,7 @@ public static void withSecurityManager(SecurityManager securityManager,
778778
* }
779779
* </pre>
780780
*
781-
* <h3>Throwing Exceptions</h3>
781+
* <b>Throwing Exceptions</b>
782782
*
783783
* <p>You can also simulate a {@code System.in} that throws an
784784
* {@code IOException} or {@code RuntimeException}. Use

system-stubs-core/src/main/java/uk/org/webcompere/systemstubs/exception/LoadingException.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@
44
* When something fails to load as part of a System Stubs operation
55
*/
66
public class LoadingException extends RuntimeException {
7+
/**
8+
* Construct the Loading exception
9+
* @param message the message
10+
* @param cause the root cause
11+
*/
712
public LoadingException(String message, Throwable cause) {
813
super(message, cause);
914
}

system-stubs-core/src/main/java/uk/org/webcompere/systemstubs/stream/input/DecoratingAltStream.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@
99
public class DecoratingAltStream extends AltInputStream {
1010
private InputStream decoratee;
1111

12+
/**
13+
* Construct the stream with the decoratee
14+
* @param decoratee the input stream that will be read from
15+
*/
1216
public DecoratingAltStream(InputStream decoratee) {
1317
this.decoratee = decoratee;
1418
}

system-stubs-core/src/main/java/uk/org/webcompere/systemstubs/stream/output/Output.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ default void clear() {
6464

6565
/**
6666
* When the target stream is meant to be closed, then close it
67+
* @throws Exception on any error closing
6768
*/
6869
default void closeOutput() throws Exception {
6970
// does nothing here

system-stubs-core/src/main/java/uk/org/webcompere/systemstubs/stream/output/OutputFactories.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ public static OutputFactory<MultiplexOutput> tapAndOutput() {
7777

7878
/**
7979
* Write to file when the output is active, closing it when it's deactivated
80+
* @param file the target file for writing to
8081
*/
8182
public static OutputFactory<FileOutputStream> writeToFile(File file) {
8283
return original -> Output.fromCloseableStream(new FileOutputStream(file));

system-stubs-interceptor/src/main/java/uk/org/webcompere/systemstubs/internal/ProcessEnvironmentInterceptor.java

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,18 @@
66

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

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

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

35+
/**
36+
* Get a single environment variable
37+
* @param name name of the variable
38+
* @return the value or null
39+
*/
2640
public static String getenv(String name) {
2741
return getenv().get(name);
2842
}
2943

44+
/**
45+
* Reads the environment variables as does getenv - a different part of
46+
* ProcessEnvironment that we're stubbing
47+
* @return the environment map
48+
*/
3049
public static Map<String, String> environment() {
3150
return getenv();
3251
}

0 commit comments

Comments
 (0)