Search in sources :

Example 6 with TestObject

use of org.finos.symphony.toolkit.workflow.fixture.TestObject in project spring-bot by finos.

the class TestEntityJsonConversion method testObjects.

@Test
public void testObjects() throws Exception {
    TestObject a1 = new TestObject("83274239874", true, true, "rob@example.com", 234786, 2138);
    TestObject a2 = new TestObject("AUD274239874", true, false, "gregb@example.com", 2386, new BigDecimal("234823498.573"));
    TestObjects a = new TestObjects(Arrays.asList(a1, a2));
    String out = toWorkflowJson(a);
    compare("{\"workflow_001\":{\"type\":\"org.finos.symphony.toolkit.workflow.fixture.testObjects\",\"version\":\"1.0\",\"items\":[{\"type\":\"org.finos.symphony.toolkit.workflow.fixture.testObject\",\"version\":\"1.0\",\"isin\":\"83274239874\",\"bidAxed\":true,\"askAxed\":true,\"creator\":\"rob@example.com\",\"bidQty\":234786,\"askQty\":2138},{\"type\":\"org.finos.symphony.toolkit.workflow.fixture.testObject\",\"version\":\"1.0\",\"isin\":\"AUD274239874\",\"bidAxed\":true,\"askAxed\":false,\"creator\":\"gregb@example.com\",\"bidQty\":2386,\"askQty\":234823498.573}]}}", out);
    TestObjects b = (TestObjects) readWorkflowValue(out);
    Assertions.assertEquals(a, b);
}
Also used : TestObjects(org.finos.symphony.toolkit.workflow.fixture.TestObjects) TestObject(org.finos.symphony.toolkit.workflow.fixture.TestObject) EJTestObject(org.finos.symphony.toolkit.workflow.fixture.EJTestObject) BigDecimal(java.math.BigDecimal) Test(org.junit.jupiter.api.Test)

Example 7 with TestObject

use of org.finos.symphony.toolkit.workflow.fixture.TestObject in project spring-bot by finos.

the class TestFormMessageML method testValidation.

@Test
public void testValidation() throws Exception {
    TestObject a = new TestObject("83274239874", true, true, "rob", 234786, 2138);
    SymphonyRoom theRoom = new SymphonyRoom("tesxt room", "abc123");
    ButtonList bl = new ButtonList();
    Button submit = new Button("submit", Type.ACTION, "GO");
    bl.add(submit);
    Errors eh = ErrorHelp.createErrorHolder();
    validator.validate(a, eh);
    WorkResponse wr = new WorkResponse(theRoom, a, WorkMode.EDIT, bl, ElementsHandler.convertErrorsToMap(eh));
    testTemplating(wr, "abc123", "testValidation.ml", "testValidation.json");
}
Also used : Errors(org.springframework.validation.Errors) Button(org.finos.symphony.toolkit.workflow.form.Button) TestObject(org.finos.symphony.toolkit.workflow.fixture.TestObject) WorkResponse(org.finos.symphony.toolkit.workflow.response.WorkResponse) ButtonList(org.finos.symphony.toolkit.workflow.form.ButtonList) SymphonyRoom(org.finos.symphony.toolkit.workflow.sources.symphony.content.SymphonyRoom) Test(org.junit.jupiter.api.Test)

Aggregations

TestObject (org.finos.symphony.toolkit.workflow.fixture.TestObject)7 Test (org.junit.jupiter.api.Test)6 BigDecimal (java.math.BigDecimal)2 EJTestObject (org.finos.symphony.toolkit.workflow.fixture.EJTestObject)2 TestObjects (org.finos.symphony.toolkit.workflow.fixture.TestObjects)2 WorkResponse (org.finos.symphony.toolkit.workflow.response.WorkResponse)2 Map (java.util.Map)1 WeirdObject (org.finos.symphony.toolkit.workflow.fixture.WeirdObject)1 Button (org.finos.symphony.toolkit.workflow.form.Button)1 ButtonList (org.finos.symphony.toolkit.workflow.form.ButtonList)1 SymphonyRoom (org.finos.symphony.toolkit.workflow.sources.symphony.content.SymphonyRoom)1 Errors (org.springframework.validation.Errors)1