use of com.github.bordertech.wcomponents.util.mock.MockResponse in project wcomponents by BorderTech.
the class WrongStepContentInterceptor_Test method testErrorDirectContent.
@Test
public void testErrorDirectContent() {
Config.getInstance().setProperty(ConfigurationProperties.STEP_ERROR_URL, "http://test.test");
MyApp app = new MyApp();
app.setLocked(true);
MockResponse response = sendContentRequest(app.appContent, 1, 99);
Assert.assertEquals("Should have returned error", HttpServletResponse.SC_BAD_REQUEST, response.getErrorCode());
}
use of com.github.bordertech.wcomponents.util.mock.MockResponse in project wcomponents by BorderTech.
the class WrongStepServerInterceptor_Test method testServiceRequestIncorrectSequenceWithRedirect.
@Test
public void testServiceRequestIncorrectSequenceWithRedirect() {
// Set redirect parameter
Configuration config = Config.copyConfiguration(originalConfig);
config.addProperty(ConfigurationProperties.STEP_ERROR_URL, "test.url");
Config.setConfiguration(config);
uic.getEnvironment().setStep(3);
request.setParameter(Environment.STEP_VARIABLE, "1");
interceptor.attachResponse(new MockResponse());
try {
interceptor.serviceRequest(request);
Assert.fail("Interceptor did not detect wrong step");
} catch (ActionEscape e) {
Assert.assertFalse("Action phase should not have occurred for step error with redirect", component.handleRequestCalled);
Assert.assertFalse("Handle Step Error should not have occurred for redirect", component.handleStepErrorCalled);
Assert.assertEquals("Step should not have been incremented", 3, uic.getEnvironment().getStep());
}
}
Aggregations