NIHVIVO-1562 Add unit tests for TemplateDirectiveModel and TemplateMethodModel help() methods that return something other than the expected type. Delete HelpDirectiveTest since it just replicated method and help directive tests in DumpDirectiveTest, and was a nuisance to maintain.
This commit is contained in:
parent
1b9f4bbdce
commit
1ef114ff45
3 changed files with 78 additions and 297 deletions
|
@ -453,7 +453,11 @@ public abstract class BaseDumpDirective implements TemplateDirectiveModel {
|
|||
Method help = cls.getMethod("help", String.class);
|
||||
try {
|
||||
return (Map<String, Object>) help.invoke(model, varName);
|
||||
} catch (Exception e) {
|
||||
} catch (ClassCastException e) {
|
||||
log.error("Method help() of " + modelClass + " of class " + cls.getName() + " has incorrect return type.");
|
||||
return null;
|
||||
} catch (Exception e) {
|
||||
//
|
||||
log.error("Error invoking method help() on " + modelClass + " of class " + cls.getName());
|
||||
return null;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue