Testsuite PoC - Allow inner classes for config to be non-public (#31656)
Signed-off-by: stianst <stianst@gmail.com>
This commit is contained in:
parent
227c71f7f0
commit
63c9fc52e9
1 changed files with 5 additions and 1 deletions
|
@ -1,10 +1,14 @@
|
||||||
package org.keycloak.test.framework.injection;
|
package org.keycloak.test.framework.injection;
|
||||||
|
|
||||||
|
import java.lang.reflect.Constructor;
|
||||||
|
|
||||||
public class SupplierHelpers {
|
public class SupplierHelpers {
|
||||||
|
|
||||||
public static <T> T getInstance(Class<T> clazz) {
|
public static <T> T getInstance(Class<T> clazz) {
|
||||||
try {
|
try {
|
||||||
return clazz.getDeclaredConstructor().newInstance();
|
Constructor<T> declaredConstructor = clazz.getDeclaredConstructor();
|
||||||
|
declaredConstructor.setAccessible(true);
|
||||||
|
return declaredConstructor.newInstance();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue