Search in sources :

Example 6 with ShowcaseContext

use of com.yandex.money.api.model.showcase.ShowcaseContext in project yandex-money-sdk-java by yandex-money.

the class ShowcaseProcessTest method testRepeat.

/**
 * Tests that recovery from erroneous input works as expected.
 */
// @Test see INC-21192
public void testRepeat() throws Exception {
    Showcase showcase = loadFromResource();
    final ShowcaseContext.Step currentStep = new ShowcaseContext.Step(showcase, BILLS_SECOND_STEP_URL);
    final ShowcaseContext showcaseContext = new ShowcaseContext(new Stack<ShowcaseContext.Step>(), DateTime.now(), currentStep, Collections.<String, String>emptyMap(), ShowcaseContext.State.UNKNOWN);
    final ShowcaseProcess showcaseProcess = new ShowcaseProcess(getClient(), showcaseContext);
    Text inn = (Text) showcase.form.items.get(0);
    inn.setValue("erroneous input");
    showcaseProcess.proceed();
    assertEquals(showcaseContext.getHistorySize(), 0);
    // repeat proceed with allowed inn
    showcase = showcaseContext.getCurrentStep().showcase;
    inn = (Text) showcase.form.items.get(0);
    inn.setValue(SAMPLE_INN);
    showcaseProcess.proceed();
    assertEquals(showcaseContext.getHistorySize(), 1);
}
Also used : Showcase(com.yandex.money.api.model.showcase.Showcase) ShowcaseContext(com.yandex.money.api.model.showcase.ShowcaseContext) Text(com.yandex.money.api.model.showcase.components.uicontrols.Text)

Aggregations

ShowcaseContext (com.yandex.money.api.model.showcase.ShowcaseContext)6 Showcase (com.yandex.money.api.model.showcase.Showcase)4 Text (com.yandex.money.api.model.showcase.components.uicontrols.Text)2 Test (org.testng.annotations.Test)2 Select (com.yandex.money.api.model.showcase.components.uicontrols.Select)1 ApiRequest (com.yandex.money.api.net.ApiRequest)1 ApiClient (com.yandex.money.api.net.clients.ApiClient)1