Skip to content

Commit 6f41ecb

Browse files
committed
Add more tests
1 parent 10bc507 commit 6f41ecb

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

slack-api-client/src/test/java/test_with_remote_apis/methods/BlockKit_Test.java

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
import com.slack.api.model.block.SectionBlock;
1818
import com.slack.api.model.block.composition.MarkdownTextObject;
1919
import com.slack.api.model.block.element.BlockElements;
20+
import com.slack.api.model.block.element.RichTextSectionElement;
2021
import config.Constants;
2122
import config.SlackTestConfig;
2223
import org.junit.AfterClass;
@@ -337,4 +338,31 @@ public void richTextInputTest() throws Exception {
337338
// rich_text_input is not allowed in a channel message
338339
assertThat(response.getError(), is("invalid_blocks"));
339340
}
341+
342+
@Test
343+
public void richTextMessage() throws Exception {
344+
loadRandomChannel();
345+
ChatPostMessageResponse response = slack.methods(botToken).chatPostMessage(r -> r
346+
.channel(randomChannelId)
347+
.text("Hey! What's up?")
348+
.blocks(Arrays.asList(
349+
richText(rt -> rt.blockId("b").elements(Arrays.asList(
350+
richTextSection(rts -> rts.elements(Arrays.asList(
351+
RichTextSectionElement.Text.builder()
352+
.style(RichTextSectionElement.TextStyle.builder().code(true).build())
353+
.text("Hey!")
354+
.build(),
355+
RichTextSectionElement.Text.builder()
356+
.text("\n")
357+
.build(),
358+
RichTextSectionElement.Text.builder()
359+
.style(RichTextSectionElement.TextStyle.builder().bold(true).build())
360+
.text("What's up?")
361+
.build()
362+
)))
363+
)))
364+
))
365+
);
366+
assertThat(response.getError(), is(nullValue()));
367+
}
340368
}

0 commit comments

Comments
 (0)