use of javax.servlet.UnavailableException in project sonar-java by SonarSource.
the class TestActionServlet method testProcessForwardConfigClassNoExtends.
/**
* Make sure processForwardConfigClass() returns what it was given if the
* forward passed to it doesn't extend anything.
*/
public void testProcessForwardConfigClassNoExtends() throws Exception {
moduleConfig.addForwardConfig(baseForward);
ForwardConfig result = null;
try {
result = actionServlet.processForwardConfigClass(baseForward, moduleConfig, null);
} catch (UnavailableException e) {
fail("An exception should not be thrown when there's nothing to do");
}
assertSame("Result should be the same as the input.", baseForward, result);
}
use of javax.servlet.UnavailableException in project sonar-java by SonarSource.
the class TestActionServlet method testInitModuleFormBeansNullFormType.
/**
* Test that initModuleFormBeans throws an exception when a form with a
* null type is present.
*/
public void testInitModuleFormBeansNullFormType() throws ServletException {
FormBeanConfig formBean = new FormBeanConfig();
formBean.setName("noTypeForm");
moduleConfig.addFormBeanConfig(formBean);
try {
actionServlet.initModuleFormBeans(moduleConfig);
fail("An exception should've been thrown here.");
} catch (UnavailableException e) {
// success
} catch (Exception e) {
fail("Unrecognized exception thrown: " + e);
}
}
use of javax.servlet.UnavailableException in project sonar-java by SonarSource.
the class TestActionServlet method testProcessActionConfigClassNoExtends.
/**
* Make sure processActionConfigClass() returns what it was given if the
* action passed to it doesn't extend anything.
*/
public void testProcessActionConfigClassNoExtends() throws Exception {
moduleConfig.addActionConfig(baseAction);
ActionConfig result = null;
try {
result = actionServlet.processActionConfigClass(baseAction, moduleConfig);
} catch (UnavailableException e) {
fail("An exception should not be thrown here");
}
assertSame("Result should be the same as the input.", baseAction, result);
}
use of javax.servlet.UnavailableException in project sonar-java by SonarSource.
the class TestActionServlet method notestProcessForwardConfigClassError.
/**
* Make sure the code throws the correct exception when it can't create an
* instance of the base config's custom class.
*/
public void notestProcessForwardConfigClassError() throws Exception {
ForwardConfig customBase = new CustomForwardConfigArg("success", "/success.jsp");
moduleConfig.addForwardConfig(customBase);
ForwardConfig customSub = new ActionForward();
customSub.setName("failure");
customSub.setExtends("success");
moduleConfig.addForwardConfig(customSub);
try {
actionServlet.processForwardConfigClass(customSub, moduleConfig, null);
fail("Exception should be thrown");
} catch (UnavailableException e) {
// success
} catch (Exception e) {
fail("Unexpected exception thrown.");
}
}
use of javax.servlet.UnavailableException in project sonar-java by SonarSource.
the class TestActionServlet method notestProcessExceptionConfigClassError.
/**
* Make sure the code throws the correct exception when it can't create an
* instance of the base config's custom class.
*/
public void notestProcessExceptionConfigClassError() throws Exception {
ExceptionConfig customBase = new CustomExceptionConfigArg("java.lang.NullPointerException");
moduleConfig.addExceptionConfig(customBase);
ExceptionConfig customSub = new ExceptionConfig();
customSub.setType("java.lang.IllegalStateException");
customSub.setExtends("java.lang.NullPointerException");
moduleConfig.addExceptionConfig(customSub);
try {
actionServlet.processExceptionConfigClass(customSub, moduleConfig, null);
fail("Exception should be thrown");
} catch (UnavailableException e) {
// success
} catch (Exception e) {
fail("Unexpected exception thrown.");
}
}
Aggregations