use of org.finos.symphony.toolkit.workflow.content.Paragraph in project spring-bot by finos.
the class TestHandlerMapping method testTableMapping.
@Test
public void testTableMapping() throws Exception {
execute("process-table <table>\n" + " <tr>\n" + " <th>Thing</th><th>Thang</th>\n" + " </tr>\n" + " <tr>\n" + " <td>1</td><td>2</td>\n" + " </tr>\n" + " <tr>\n" + " <td>3</td><td>4</td>\n" + " </tr>\n" + " </table> <span class=\"entity\" data-entity-id=\"1\">@gaurav</span>");
Assertions.assertEquals("process-table", oc.lastMethod);
Assertions.assertEquals(2, oc.lastArguments.size());
Table firstArgument = (Table) oc.lastArguments.get(0);
List<Paragraph> expected = Arrays.asList(Paragraph.of(Arrays.asList(Word.of("thing"))), Paragraph.of(Arrays.asList(Word.of("thang"))));
Assertions.assertEquals(expected, firstArgument.getColumnNames());
Assertions.assertEquals(2, firstArgument.getData().size());
}
use of org.finos.symphony.toolkit.workflow.content.Paragraph in project spring-bot by finos.
the class TestContents method testContents.
@Test
public void testContents() {
// tag def
doAssertsOnContent(new CashTag("id123"), new CashTag("id123"));
doAssertsOnContent(new HashTag("id123"), new HashTag("id123"));
// room def
doAssertsOnObject(new SymphonyRoom("abc", "abc123"), new SymphonyRoom("abc", "abc123"));
doAssertsOnObject(new SymphonyRoom(null, "abc123"), new SymphonyRoom(null, "abc123"));
doAssertsOnObject(new SymphonyRoom("abc", "abc123"), new SymphonyRoom("abc", "abc123"));
doAssertsOnObject(new SymphonyRoom("abc", null), new SymphonyRoom("abc", null));
// user def
doAssertsOnObject(new SymphonyUser(123l, "rob", "rob@example.com"), new SymphonyUser(123l, "rob", "rob@example.com"));
doAssertsOnObject(new SymphonyUser("rob", "rob@example.com"), new SymphonyUser("rob", "rob@example.com"));
doAssertsOnObject(new SymphonyUser(null, "rob@example.com"), new SymphonyUser(null, "rob@example.com"));
doAssertsOnObject(new SymphonyUser(123l, "rob", null), new SymphonyUser(123l, "rob", null));
// id
UUID some = UUID.randomUUID();
doAssertsOnContent(HashTag.createID(some), HashTag.createID(some));
// wordx
Word w1 = Word.of("hello");
Word w2 = Word.of("bye");
doAssertsOnContent(w1, Word.of("hello"));
// paragraph
Paragraph p1 = Paragraph.of(Arrays.asList(w1, w2));
Paragraph p2 = Paragraph.of(Arrays.asList(w1, w2));
doAssertsOnContent(p1, p2);
doAssertsOnContent(p1.getNth(Word.class, 0).get(), p2.getNth(Word.class, 0).get());
// message
Message m1 = Message.of(Arrays.asList(p1, p2));
Message m2 = Message.of(Arrays.asList(p1, p2));
doAssertsOnContent(m1, m2);
}
use of org.finos.symphony.toolkit.workflow.content.Paragraph in project spring-bot by finos.
the class TestMessageMLParser method testRemoveStart.
@Test
public void testRemoveStart() {
Word one = Word.of("one");
Word two = Word.of("two");
Word three = Word.of("three");
Paragraph p1 = Paragraph.of(Arrays.asList(one, two, three));
Paragraph p1_ = Paragraph.of(Arrays.asList(two, three));
Message m1 = Message.of(Arrays.asList(p1));
Message m2 = Message.of(Arrays.asList(p1_));
Assertions.assertEquals(m1.removeAtStart(one), m2);
}
use of org.finos.symphony.toolkit.workflow.content.Paragraph in project spring-bot by finos.
the class TestMessageMLParser method testWithout.
@Test
public void testWithout() {
Word one = Word.of("one");
Word two = Word.of("two");
Word three = Word.of("three");
Paragraph p1 = Paragraph.of(Arrays.asList(one, two, three));
Paragraph p2 = Paragraph.of(Arrays.asList(one, three));
Paragraph p1_ = Paragraph.of(Arrays.asList(one, two));
Paragraph p2_ = Paragraph.of(Arrays.asList(one));
Message m1 = Message.of(Arrays.asList(p1, p2));
Message m2 = Message.of(Arrays.asList(p1_, p2_));
Assertions.assertEquals(m1.without(three), m2);
}
Aggregations