use of com.walmartlabs.concord.client.FormSubmitResponse in project concord by walmartlabs.
the class FormIT method test.
/**
* A straightforward single form process.
*/
@Test
public void test() throws Exception {
Payload payload = new Payload().archive(resource("form"));
// ---
ConcordProcess proc = concord.processes().start(payload);
expectStatus(proc, ProcessEntry.StatusEnum.SUSPENDED);
// ---
List<FormListEntry> forms = proc.forms();
assertEquals(1, forms.size());
// ---
FormListEntry myForm = forms.get(0);
assertFalse(myForm.isCustom());
String formName = myForm.getName();
String firstName = "john_" + randomString();
String lastName = "smith_" + randomString();
int age = ThreadLocalRandom.current().nextInt(100);
Map<String, Object> data = new HashMap<>();
data.put("lastName", lastName);
data.put("firstName", firstName);
data.put("age", age);
FormSubmitResponse fsr = proc.submitForm(formName, data);
assertTrue(fsr.isOk());
assertTrue(fsr.getErrors() == null || fsr.getErrors().isEmpty());
assertEquals(0, proc.forms().size());
expectStatus(proc, ProcessEntry.StatusEnum.FINISHED);
// ---
proc.assertLog(".*firstName=" + firstName + ".*");
proc.assertLog(".*lastName=" + lastName + ".*");
proc.assertLog(".*age=" + age + ".*");
}
Aggregations