8141353: Testlibrary: add various changes into testlibrary Utils

Added TEST_JDK, TEST_CLASSES properties and getMandatoryProperty method

Reviewed-by: iignatyev
This commit is contained in:
Dmitrij Pochepko 2015-11-06 14:51:15 +03:00
parent 26f02e4686
commit 48183cc207

@ -44,6 +44,7 @@ import java.util.Iterator;
import java.util.Map;
import java.util.HashMap;
import java.util.List;
import java.util.Objects;
import java.util.Random;
import java.util.function.BooleanSupplier;
import java.util.concurrent.TimeUnit;
@ -82,6 +83,16 @@ public final class Utils {
*/
public static final String TEST_SRC = System.getProperty("test.src", ".").trim();
/*
* Returns the value of 'test.jdk' system property
*/
public static final String TEST_JDK = System.getProperty("test.jdk");
/**
* Returns the value of 'test.classes' system property
*/
public static final String TEST_CLASSES = System.getProperty("test.classes", ".");
private static Unsafe unsafe = null;
/**
@ -616,5 +627,18 @@ public final class Utils {
NULL_VALUES.put(float.class, 0.0f);
NULL_VALUES.put(double.class, 0.0d);
}
/**
* Returns mandatory property value
* @param propName is a name of property to request
* @return a String with requested property value
*/
public static String getMandatoryProperty(String propName) {
Objects.requireNonNull(propName, "Requested null property");
String prop = System.getProperty(propName);
Objects.requireNonNull(prop,
String.format("A mandatory property '%s' isn't set", propName));
return prop;
}
}