public class CommonTestUtils extends Object
Constructor and Description |
---|
CommonTestUtils() |
Modifier and Type | Method and Description |
---|---|
static void |
assumeJava8()
Checks whether this code runs in a Java 8 (Java 1.8) JVM.
|
static void |
blockForeverNonInterruptibly()
Permanently blocks the current thread.
|
static <T extends Serializable> |
createCopySerializable(T original)
Creates a copy of an object via Java Serialization.
|
static String |
createTempFile(String contents)
Creates a temporary file that contains the given string.
|
static String |
getTempDir()
Reads the path to the directory for temporary files from the configuration and returns it.
|
static void |
setEnv(Map<String,String> newenv) |
static void |
setEnv(Map<String,String> newenv,
boolean clearExisting) |
public static String getTempDir()
public static <T extends Serializable> T createCopySerializable(T original) throws IOException
original
- The original object.IOException
public static String createTempFile(String contents) throws IOException
The temp file is automatically deleted on JVM exit.
contents
- The contents to be written to the file.IOException
public static void blockForeverNonInterruptibly()
Thread.interrupt()
.public static void assumeJava8()
AssumptionViolatedException
, which causes JUnit to skip the test that
called this method.Copyright © 2014–2017 The Apache Software Foundation. All rights reserved.