TAMAYA-259: Added tests.
Project: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/commit/9050e020 Tree: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/tree/9050e020 Diff: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/diff/9050e020 Branch: refs/heads/master Commit: 9050e020b8cb9595e64fd0f7e600157bb8eb779a Parents: 2c1f5df Author: anatole <anat...@apache.org> Authored: Sun Mar 19 22:02:04 2017 +0100 Committer: anatole <anat...@apache.org> Committed: Sun Mar 19 22:02:04 2017 +0100 ---------------------------------------------------------------------- .../java/org/apache/tamaya/features/Features.java | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/9050e020/modules/features/src/main/java/org/apache/tamaya/features/Features.java ---------------------------------------------------------------------- diff --git a/modules/features/src/main/java/org/apache/tamaya/features/Features.java b/modules/features/src/main/java/org/apache/tamaya/features/Features.java index 3b73635..de1b2af 100644 --- a/modules/features/src/main/java/org/apache/tamaya/features/Features.java +++ b/modules/features/src/main/java/org/apache/tamaya/features/Features.java @@ -163,12 +163,23 @@ public final class Features { } /** - * Checks if the given class canm be loaded, using {@code Class.forName(classname)}. + * Checks if the given class canm be loaded, using {@code Class.forName(classname)} + * using the current Thread Context ClassLoader. + * @param classname the fully qualified classname. * @return true, if the given class canm be loaded. */ public static boolean checkClassIsLoadable(String classname) { + return checkClassIsLoadable(classname, Thread.currentThread().getContextClassLoader()); + } + + /** + * Checks if the given class canm be loaded, using {@code Class.forName(classname)}. + * @param classname the fully qualified classname. + * @return true, if the given class canm be loaded. + */ + public static boolean checkClassIsLoadable(String classname, ClassLoader classLoader) { try{ - Class.forName(Objects.requireNonNull(classname), false, Thread.currentThread().getContextClassLoader()); + Class.forName(Objects.requireNonNull(classname), false, classLoader); return true; }catch(Throwable e){ return false;