public void mustRenderRequestSubmittedWindow() { USSDApplication app = getTestApp1(); USSDRequest request = app.newRequest("1234"); fillRequest(request); USSDResponse response = BantU.executeRequest(getTestApp1(), request); Assert.AreEqual("operations", response.getWindow().getId()); Assert.AreEqual(ResponseType.FORM, response.getResponseType()); request = app.newRequest("1"); fillRequest(request); response = BantU.executeRequest(getTestApp1(), request); Assert.AreEqual("transfers", response.getWindow().getId()); Assert.AreEqual(ResponseType.FORM, response.getResponseType()); request = app.newRequest("2"); fillRequest(request); response = BantU.executeRequest(getTestApp1(), request); Assert.AreEqual("amountWindow", response.getWindow().getId()); Assert.AreEqual(ResponseType.FORM, response.getResponseType()); request = app.newRequest("1000"); fillRequest(request); response = BantU.executeRequest(getTestApp1(), request); Assert.AreEqual("requestSubmitted", response.getWindow().getId()); Assert.AreEqual(ResponseType.MESSAGE, response.getResponseType()); }
protected void delegateRequest(USSDRequest request, USSDSession <Object> session, USSDResponse response) { USSDResponse ussdResponse = BantU.executeRequest(application, request, session); response.setWindow(ussdResponse.getWindow()); response.setResponseType(ussdResponse.getResponseType()); response.setSession(ussdResponse.getSession()); }
public void mustRenderOperationsWindow() { USSDRequest request = getTestApp1().newRequest("1234"); fillRequest(request); USSDResponse response = BantU.executeRequest(getTestApp1(), request); Assert.AreEqual("operations", response.getWindow().getId()); Assert.AreEqual(ResponseType.FORM, response.getResponseType()); }
public void mustRenderLoginWindow() { USSDRequest request = getTestApp1().newRequest(TEST_BASE_CODE); fillRequest(request); USSDResponse response = BantU.executeRequest(getTestApp1(), request); Assert.AreEqual("login", response.getWindow().getId()); Assert.AreEqual(ResponseType.FORM, response.getResponseType()); }
public void mustRenderPasswordRecoverWindow() { USSDRequest request = getTestApp1().newRequest("1111"); fillRequest(request); USSDApplication app = getTestApp1(); USSDResponse response = BantU.executeRequest(getTestApp1(), request); Assert.AreEqual("recoverPassowrd", response.getWindow().getId()); Assert.AreEqual(ResponseType.MESSAGE, response.getResponseType()); }
public void windowFilterMustBeInvoked() { USSDApplication app = new BaseUSSDApplication(); Window window = new Window("startup"); window.addMessage(new Message("Welcome, please type something")); window.setInput(new Input { Name = "something" }); app.addWindowFilter(window.getId(), new StartupWindowFirstFilter()); app.addWindowFilter(window.getId(), new StartupWindowSecondFilter()); app.addWindow(window); app.setStartupWindowId(window.getId()); USSDRequest request = app.newRequest(TEST_BASE_CODE); fillRequest(request); USSDResponse response = BantU.executeRequest(app, request); Assert.AreEqual("Altered by the second filter", response.getWindow().getMessages()[0]); }
public void doFilter(USSDRequest request, USSDSession <Object> session, USSDResponse response, USSDFilteringChain chain) { chain.proceed(request, session, response); response.getWindow().getMessages()[0].setContent("Altered by the second filter"); }