use of com.yandex.money.api.model.showcase.Showcase 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.Showcase 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.Showcase in project yandex-money-sdk-java by yandex-money.
the class ShowcaseProcessTest method getEmptyShowcase.
private static Showcase getEmptyShowcase() {
Group.Builder builder = new Group.Builder();
Group group = builder.create();
return new Showcase.Builder().setTitle("foo").setErrors(Collections.<Showcase.Error>emptyList()).setForm(group).setHiddenFields(Collections.<String, String>emptyMap()).setMoneySources(Collections.<AllowedMoneySource>emptyList()).create();
}
use of com.yandex.money.api.model.showcase.Showcase in project yandex-money-sdk-java by yandex-money.
the class ShowcaseTypeAdapterTest method testShowcase.
private static void testShowcase(String fileName) {
ShowcaseTypeAdapter adapter = ShowcaseTypeAdapter.getInstance();
check(fileName, adapter);
try {
Showcase showcase = adapter.fromJson(Resources.load(getPath(fileName)));
Object allowedMoneySource = showcase.moneySources.get(0);
assertEquals(allowedMoneySource.getClass(), AllowedMoneySource.class);
} catch (FileNotFoundException e) {
fail();
}
}
use of com.yandex.money.api.model.showcase.Showcase in project yandex-money-sdk-java by yandex-money.
the class ShowcaseTest method testShowcaseParameters.
@Test
public void testShowcaseParameters() throws FileNotFoundException {
Showcase showcase = ShowcaseTypeAdapter.getInstance().fromJson(Resources.load("/model/showcase.json"));
assertNotNull(showcase);
Map<String, String> parameters = showcase.getPaymentParameters();
assertNotNull(parameters);
assertFalse(parameters.isEmpty());
assertNotNull(showcase.hiddenFields);
assertFalse(showcase.hiddenFields.isEmpty());
for (Map.Entry<String, String> field : showcase.hiddenFields.entrySet()) {
String key = field.getKey();
String value = parameters.get(key);
assertNotNull(value);
assertTrue(value.equals(field.getValue()));
}
}
Aggregations