### Question:
DefaultActionProxy implements ActionProxy, Serializable { protected void prepare() { config = configuration.getRuntimeConfiguration().getActionConfig(namespace, actionName); if (config == null && unknownHandlerManager.hasUnknownHandlers()) { config = unknownHandlerManager.handleUnknownAction(namespace, actionName); } if (config == null) { throw new ConfigurationException(getErrorMessage()); } resolveMethod(); if (config.isAllowedMethod(method)) { invocation.init(this); } else { throw new ConfigurationException(prepareNotAllowedErrorMessage()); } } protected  DefaultActionProxy(ActionInvocation inv, String namespace, String actionName, String methodName, boolean executeResult, boolean cleanupContext); @Inject void setObjectFactory(ObjectFactory factory); @Inject void setConfiguration(Configuration config); @Inject void setUnknownHandler(UnknownHandlerManager unknownHandlerManager); @Inject(required = false) void setActionEventListener(ActionEventListener listener); @Inject void setLocalizedTextProvider(LocalizedTextProvider localizedTextProvider); Object getAction(); String getActionName(); ActionConfig getConfig(); void setExecuteResult(boolean executeResult); boolean getExecuteResult(); ActionInvocation getInvocation(); String getNamespace(); String execute(); String getMethod(); boolean isMethodSpecified();  }### Answer:
@Test public void testThorwExceptionOnNotAllowedMethod() throws Exception { final String filename = "com/opensymphony/xwork2/config/providers/xwork-test-allowed-methods.xml"; loadConfigurationProviders(new XmlConfigurationProvider(filename)); DefaultActionProxy dap = new DefaultActionProxy(new MockActionInvocation(), "strict", "Default", "notAllowed", true, true); container.inject(dap); try { dap.prepare(); fail("Must throw exception!"); } catch (Exception e) { assertEquals(e.getMessage(), "Method notAllowed for action Default is not allowed!"); } }