use of org.finos.symphony.toolkit.workflow.fixture.TestObjects in project spring-bot by finos.
the class TestFormMessageML method createAxesWorkResponse.
protected WorkResponse createAxesWorkResponse(WorkMode wm) {
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));
WorkResponse wr = createWorkAddSubmit(wm, a);
return wr;
}
use of org.finos.symphony.toolkit.workflow.fixture.TestObjects in project spring-bot by finos.
the class TestHistory method testGetLast.
@Test
public void testGetLast() {
TestObjects to = new TestObjects();
Mockito.when(messagesApi.v1MessageSearchPost(Mockito.any(), Mockito.isNull(), Mockito.isNull(), Mockito.anyInt(), Mockito.anyInt(), Mockito.any(), Mockito.any())).thenAnswer(a -> {
V4MessageList out = new V4MessageList();
out.addAll(Arrays.asList(makeMessage(to)));
return out;
});
TestObjects out = mh.getLastFromHistory(TestObjects.class, new SymphonyRoom("someroom", "abc123")).orElseThrow(() -> new RuntimeException());
Assertions.assertEquals(out, to);
Assertions.assertFalse(out == to);
}
use of org.finos.symphony.toolkit.workflow.fixture.TestObjects 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);
}
use of org.finos.symphony.toolkit.workflow.fixture.TestObjects in project spring-bot by finos.
the class TestFormConverter method testFormContainingList.
@SuppressWarnings("unchecked")
@Test
public void testFormContainingList() throws Exception {
Object o = om.readValue("{\"action\":\"add+0\",\"items.[0].isin.\":\"fd3442\",\"items.[0].bidAxed.\":\"true\",\"items.[0].askAxed.\":\"true\",\"items.[0].creator.\":\"tr\",\"items.[0].bidQty.\":\"32432\",\"items.[0].askQty.\":\"234\"}", Map.class);
TestObjects to = (TestObjects) fc.convert((Map<String, Object>) o, TestObjects.class.getCanonicalName());
Assertions.assertEquals("fd3442", to.getItems().get(0).getIsin());
Assertions.assertEquals("tr", to.getItems().get(0).getCreator());
Assertions.assertEquals(32432, to.getItems().get(0).getBidQty());
}
use of org.finos.symphony.toolkit.workflow.fixture.TestObjects in project spring-bot by finos.
the class TestHistory method testFindInHistory.
@Test
public void testFindInHistory() {
TestObjects one = new TestObjects();
TestObjects two = new TestObjects();
TestObjects three = new TestObjects();
Mockito.when(messagesApi.v1MessageSearchPost(Mockito.any(), Mockito.isNull(), Mockito.isNull(), Mockito.anyInt(), Mockito.anyInt(), Mockito.any(), Mockito.any())).thenAnswer(a -> {
V4MessageList out = new V4MessageList();
out.addAll(Arrays.asList(makeMessage(one), makeMessage(two), makeMessage(three)));
return out;
});
List<TestObjects> out = mh.getFromHistory(TestObjects.class, new SymphonyRoom("someroom", "abc123"), Instant.now().minus(10, ChronoUnit.DAYS));
Assertions.assertEquals(3, out.size());
Assertions.assertEquals(one, out.get(0));
Assertions.assertEquals(two, out.get(1));
Assertions.assertEquals(three, out.get(2));
Mockito.verify(messagesApi).v1MessageSearchPost(Mockito.argThat(e -> {
MessageSearchQuery msq = (MessageSearchQuery) e;
return msq.getHashtag().equals(TestObjects.class.getCanonicalName().replace(".", "-").toLowerCase());
}), Mockito.isNull(), Mockito.isNull(), Mockito.eq(0), Mockito.eq(50), Mockito.isNull(), Mockito.isNull());
}
Aggregations