### Question:
SimonConsoleRequestProcessor { protected void initActionBindings() { addActionBinding(new ActionBinding<Action>() { public boolean supports(ActionContext actionContext) { return actionContext.getPath().isEmpty(); } public Action create(ActionContext actionContext) { return new RedirectAction(actionContext.getRequest().getContextPath() + urlPrefix + ROOT_PATH, actionContext); } }); addResourceActionBinding("/", ROOT_PATH); addResourceActionBinding(ROOT_PATH, ROOT_PATH); addResourceActionBinding(TREE_PATH, TREE_PATH); addResourceActionBinding(DETAIL_PATH, DETAIL_PATH); addActionBinding(new ActionBinding<Action>() { private final String pathPrefix = "/resource"; public boolean supports(ActionContext actionContext) { return actionContext.getPath().startsWith(pathPrefix); } public Action create(ActionContext actionContext) { return new ResourceAction(actionContext, actionContext.getPath().substring(pathPrefix.length())); } }); addSimpleActionBinding(TableJsonAction.PATH, TableJsonAction.class); addSimpleActionBinding(ListJsonAction.PATH, ListJsonAction.class); addSimpleActionBinding(TreeJsonAction.PATH, TreeJsonAction.class); addSimpleActionBinding(TableJsonAction.PATH, TableJsonAction.class); addSimpleActionBinding(TableHtmlAction.PATH, TableHtmlAction.class); addSimpleActionBinding(TableCsvAction.PATH, TableCsvAction.class); addSimpleActionBinding(TreeXmlAction.PATH, TreeXmlAction.class); addSimpleActionBinding(ClearAction.PATH, ClearAction.class); addSimpleActionBinding(DetailHtmlAction.PATH, DetailHtmlAction.class); addSimpleActionBinding(DetailJsonAction.PATH, DetailJsonAction.class); addSimpleActionBinding(PluginsJsonAction.PATH, PluginsJsonAction.class); for (ActionBinding actionBinding : pluginManager.getActionBindings()) { addActionBinding(actionBinding); } if (LOGGER.isDebugEnabled()) { if (!pluginManager.getPlugins().isEmpty()) { StringBuilder logBuilder = new StringBuilder(); for(SimonConsolePlugin plugin: pluginManager.getPlugins()) { logBuilder.append(plugin.getId()).append(':').append(plugin.getClass().getName()).append(' '); } LOGGER.debug(logBuilder.append("plugins registered").toString()); } StringBuilder logBuilder = new StringBuilder(); for(ActionBinding actionBinding: actionBindings) { if (actionBinding instanceof SimpleActionBinding) { SimpleActionBinding simpleActionBinding = (SimpleActionBinding) actionBinding; logBuilder.append(urlPrefix).append(simpleActionBinding.getPath()).append(':') .append(simpleActionBinding.getActionClass().getName()).append(' '); } } LOGGER.debug(logBuilder.append("actions bound").toString()); } } SimonConsoleRequestProcessor(String urlPrefix); final void addActionBinding(ActionBinding actionBinding); final void addSimpleActionBinding(String actionPath, Class<T> actionClass); void addResourceActionBinding(final String actionPath, final String resourcePath); String getUrlPrefix(); Manager getManager(); void setManager(Manager manager); SimonConsolePluginManager getPluginManager(); static SimonConsoleRequestProcessor create(String urlPrefix, Manager manager, String pluginClasses); static final String ROOT_PATH; static final String TREE_PATH; static final String DETAIL_PATH; }### Answer:
@Test public void testInit() throws Exception { requestProcessor.initActionBindings(); assertActionBinding("/resources/js/foo.js", ResourceAction.class); assertActionBinding("/data/table.json", TableJsonAction.class); assertActionBinding("/data/detail.json", DetailJsonAction.class); assertActionBinding("/data/tree.json", TreeJsonAction.class); }