use of com.yandex.money.api.model.showcase.ShowcaseContext in project yandex-money-sdk-java by yandex-money.
the class ShowcaseParserTest method testShowcase.
private void testShowcase(ApiClient client, long scid) throws Exception {
ShowcaseContext showcaseContext = client.execute(new Showcase.Request(scid));
assertNotNull(showcaseContext);
assertNotNull(showcaseContext.getCurrentStep().showcase);
}
use of com.yandex.money.api.model.showcase.ShowcaseContext in project yandex-money-sdk-java by yandex-money.
the class ShowcaseProcessTest method testProceedFail.
/**
* Tests that erroneous leads to
* {@link ShowcaseContext.State#INVALID_PARAMS} state.
*/
// @Test see INC-21192
public void testProceedFail() throws Exception {
Showcase showcase = loadFromResource();
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);
showcaseProcess.proceed();
assertEquals(showcaseContext.getState(), ShowcaseContext.State.INVALID_PARAMS);
assertEquals(showcaseContext.getHistorySize(), 0);
}
use of com.yandex.money.api.model.showcase.ShowcaseContext in project yandex-money-sdk-java by yandex-money.
the class ShowcaseProcessTest method initShowcaseProcess.
private static ShowcaseProcess initShowcaseProcess() throws Exception {
final ApiRequest<ShowcaseContext> resReq = new Showcase.Request(5551);
final ApiClient client = getClient();
final ShowcaseContext showcaseContext = client.execute(resReq);
return new ShowcaseProcess(client, showcaseContext);
}
use of com.yandex.money.api.model.showcase.ShowcaseContext in project yandex-money-sdk-java by yandex-money.
the class ShowcaseProcessTest method testProceedSuccess.
/**
* Tests that complex showcase successfully proceeds two steps asynchronously.
*
* @throws Exception if something goes wrong
*/
@Test
public void testProceedSuccess() throws Exception {
final ShowcaseProcess showcaseProcess = initShowcaseProcess();
final ShowcaseContext showcaseContext = showcaseProcess.showcaseContext;
Showcase showcase = showcaseContext.getCurrentStep().showcase;
final Text inn = (Text) showcase.form.items.get(0);
inn.setValue(SAMPLE_INN);
showcaseProcess.proceed();
assertEquals(showcaseContext.getHistorySize(), 1);
showcase = showcaseContext.getCurrentStep().showcase;
((Text) showcase.form.items.get(0)).setValue("Содружество Авангард");
((Select) showcase.form.items.get(1)).setValue("40702810055240000859");
showcaseProcess.proceed();
assertEquals(showcaseContext.getHistorySize(), 2);
showcaseProcess.proceed();
assertEquals(showcaseContext.getHistorySize(), 3);
}
use of com.yandex.money.api.model.showcase.ShowcaseContext in project yandex-money-sdk-java by yandex-money.
the class ShowcaseProcessTest method testComplete.
/**
* Tests that showcase process returns {@code true} in case of completed showcase context.
*/
@Test
public void testComplete() throws Exception {
final ShowcaseContext completedShowcaseContext = new ShowcaseContext(new Stack<ShowcaseContext.Step>(), DateTime.now(), new ShowcaseContext.Step(getEmptyShowcase(), "http://foobar.foo"), Collections.<String, String>emptyMap(), ShowcaseContext.State.COMPLETED);
final ShowcaseProcess showcaseProcess = new ShowcaseProcess(getClient(), completedShowcaseContext);
assertTrue(showcaseProcess.proceed());
}
Aggregations