Search in sources :

Example 1 with FormSubmitResult

use of io.takari.bpm.form.FormSubmitResult in project concord by walmartlabs.

the class YamlParserTest method test104.

@Test
public void test104() throws Exception {
    deploy("104.yml");
    String valueA = "a_" + System.currentTimeMillis();
    String valueB = "b_" + System.currentTimeMillis();
    String valueC = "c_" + System.currentTimeMillis();
    // ---
    TestBean testBean = spy(new TestBean(new String[] { valueA, valueB, valueC }));
    register("testBean", testBean);
    // ---
    String key = UUID.randomUUID().toString();
    start(key, "main", null);
    // ---
    UUID formId = getFirstFormId();
    Map<String, Object> data = Collections.singletonMap("testValue", valueB);
    FormSubmitResult result = submitForm(formId, data);
    assertTrue(result.isValid());
    verify(testBean, times(1)).toString(eq(valueB));
}
Also used : FormSubmitResult(io.takari.bpm.form.FormSubmitResult) Mockito.anyString(org.mockito.Mockito.anyString) Test(org.junit.jupiter.api.Test)

Example 2 with FormSubmitResult

use of io.takari.bpm.form.FormSubmitResult in project concord by walmartlabs.

the class YamlParserTest method test107.

@Test
public void test107() throws Exception {
    deploy("107.yml");
    TestBean testBean = spy(new TestBean());
    register("testBean", testBean);
    // ---
    String key = UUID.randomUUID().toString();
    start(key, "main", null);
    // ---
    UUID formId = getFirstFormId();
    FormSubmitResult result = submitForm(formId, Collections.singletonMap("testValue", "else"));
    assertTrue(result.isValid());
    verify(testBean, times(1)).toString(eq("else"));
}
Also used : FormSubmitResult(io.takari.bpm.form.FormSubmitResult) Mockito.anyString(org.mockito.Mockito.anyString) Test(org.junit.jupiter.api.Test)

Example 3 with FormSubmitResult

use of io.takari.bpm.form.FormSubmitResult in project concord by walmartlabs.

the class YamlParserTest method test105.

@Test
public void test105() throws Exception {
    deploy("105.yml");
    String valueA = "a_" + System.currentTimeMillis();
    String valueB = "b_" + System.currentTimeMillis();
    String valueC = "c_" + System.currentTimeMillis();
    // ---
    TestBean testBean = spy(new TestBean(new String[] { valueA, valueB, valueC }));
    register("testBean", testBean);
    // ---
    String key = UUID.randomUUID().toString();
    start(key, "main", null);
    // ---
    UUID formId = getFirstFormId();
    FormSubmitResult result = submitForm(formId, Collections.emptyMap());
    assertFalse(result.isValid());
    verify(testBean, never()).toString(any());
}
Also used : FormSubmitResult(io.takari.bpm.form.FormSubmitResult) Mockito.anyString(org.mockito.Mockito.anyString) Test(org.junit.jupiter.api.Test)

Example 4 with FormSubmitResult

use of io.takari.bpm.form.FormSubmitResult in project concord by walmartlabs.

the class YamlParserTest method test109.

@Test
public void test109() throws Exception {
    deploy("109.yml");
    TestBean testBean = spy(new TestBean());
    register("testBean", testBean);
    // ---
    String key = UUID.randomUUID().toString();
    start(key, "main", null);
    // ---
    UUID formId = getFirstFormId();
    FormSubmitResult result = submitForm(formId, Collections.singletonMap("testValue", "else"));
    assertTrue(result.isValid());
    verify(testBean, times(1)).toString(eq("else"));
}
Also used : FormSubmitResult(io.takari.bpm.form.FormSubmitResult) Mockito.anyString(org.mockito.Mockito.anyString) Test(org.junit.jupiter.api.Test)

Example 5 with FormSubmitResult

use of io.takari.bpm.form.FormSubmitResult in project concord by walmartlabs.

the class YamlParserTest method test106.

@Test
public void test106() throws Exception {
    deploy("106.yml");
    TestBean testBean = spy(new TestBean());
    register("testBean", testBean);
    // ---
    String key = UUID.randomUUID().toString();
    start(key, "main", null);
    // ---
    UUID formId = getFirstFormId();
    FormSubmitResult result = submitForm(formId, Collections.singletonMap("testValue", "d"));
    assertFalse(result.isValid());
    result = submitForm(formId, Collections.singletonMap("testValue", "a"));
    assertTrue(result.isValid());
    verify(testBean, times(1)).toString(eq("a"));
}
Also used : FormSubmitResult(io.takari.bpm.form.FormSubmitResult) Mockito.anyString(org.mockito.Mockito.anyString) Test(org.junit.jupiter.api.Test)

Aggregations

FormSubmitResult (io.takari.bpm.form.FormSubmitResult)9 Test (org.junit.jupiter.api.Test)9 Mockito.anyString (org.mockito.Mockito.anyString)9 Form (io.takari.bpm.form.Form)1