< prev index next >

test/testlibrary/jdk/test/lib/Utils.java

Print this page

        

*** 457,466 **** --- 457,481 ---- public static long adjustTimeout(long tOut) { return Math.round(tOut * Utils.TIMEOUT_FACTOR); } /** + * Ensures a requested class is loaded + * @param aClass class to load + */ + public static void ensureClassIsLoaded(Class<?> aClass) { + if (aClass == null) { + throw new Error("Requested null class"); + } + try { + Class.forName(aClass.getName(), /* initialize = */ true, + ClassLoader.getSystemClassLoader()); + } catch (ClassNotFoundException e) { + throw new Error("Class not found", e); + } + } + /** * Runs runnable and checks that it throws expected exception. If exceptionException is null it means * that we expect no exception to be thrown. * @param runnable what we run * @param expectedException expected exception */
< prev index next >