use of jakarta.faces.FactoryFinder in project myfaces by apache.
the class FactoryFinderTest method getRegisteredFactoryNames.
/*
* This method allows us access to the _registeredFactoryNames field so we can test the content of that map during
* the running of this test.
*
* @return Returns the _registeredFactoryNames Map from the FactoryFinder class. @throws NoSuchFieldException
*
* @throws IllegalAccessException
*/
@SuppressWarnings("unchecked")
private Map<ClassLoader, Map<String, List<String>>> getRegisteredFactoryNames() throws IllegalAccessException {
Class<FactoryFinder> factoryFinderClass = FactoryFinder.class;
Field[] fields = factoryFinderClass.getDeclaredFields();
Field field = null;
for (int i = 0; i < fields.length; i++) {
if (fields[i].getName().equals("registeredFactoryNames")) {
field = fields[i];
field.setAccessible(true);
break;
}
}
Map<ClassLoader, Map<String, List<String>>> _registeredFactoryNames = (Map<ClassLoader, Map<String, List<String>>>) field.get(null);
return _registeredFactoryNames;
}
Aggregations