use of org.mifos.framework.exceptions.ConstantsNotLoadedException in project head by mifos.
the class ConstPlugin method buildClasses.
List<Class> buildClasses(List<String> constantFileNameList) throws ConstantsNotLoadedException {
List<Class> constantClassNameList = new ArrayList<Class>();
String constantFileName = null;
try {
for (String fileName : constantFileNameList) {
constantFileName = fileName.trim();
constantClassNameList.add(Class.forName(constantFileName));
}
} catch (ClassNotFoundException cnfe) {
Object[] values = new Object[] { constantFileName };
throw new ConstantsNotLoadedException(ExceptionConstants.CONSTANTSNOTLOADEDEXCEPTION, cnfe, values);
}
return constantClassNameList;
}
use of org.mifos.framework.exceptions.ConstantsNotLoadedException in project head by mifos.
the class ConstPluginStrutsTest method testConstantsPluginException.
@Test
public void testConstantsPluginException() throws Exception {
ConstPlugin constPlugin = new ConstPlugin();
ArrayList<String> constPluginClasses = new ArrayList<String>();
constPluginClasses.add("org.mifos.doesNotExist");
try {
Class doesNotExistClass = ConstPlugin.class;
Field[] fields = doesNotExistClass.getDeclaredFields();
Field field = fields[0];
ConstPlugin.checkModifiers(field);
} catch (ConstantsNotLoadedException expected) {
}
try {
constPlugin.buildClasses(constPluginClasses);
Assert.fail();
} catch (ConstantsNotLoadedException expected) {
}
}
Aggregations