Repository navigation
Expand file tree
/
Copy pathCardTest.java
More file actions
55 lines (52 loc) · 1.66 KB
/
Copy pathCardTest.java
File metadata and controls
55 lines (52 loc) · 1.66 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
package blocks;
import static org.junit.jupiter.api.Assertions.assertEquals;
import com.google.gson.JsonParser;
import com.slack.api.model.block.CardBlock;
import com.slack.api.util.json.GsonFactory;
import org.junit.jupiter.api.Test;
public class CardTest {
@Test
public void testExample01() {
CardBlock block = Card.example01();
String actual = GsonFactory.createSnakeCase().toJson(block);
String expected = """
{
"type": "card",
"icon": {
"type": "image",
"image_url": "https://picsum.photos/36/36",
"alt_text": "Icon"
},
"title": {
"type": "mrkdwn",
"text": "Lumon Industries"
},
"subtitle": {
"type": "mrkdwn",
"text": "Committed to work-life balance"
},
"hero_image": {
"type": "image",
"image_url": "https://picsum.photos/400/300",
"alt_text": "Sample hero image"
},
"body": {
"type": "mrkdwn",
"text": "Please enjoy each card equally."
},
"actions": [
{
"type": "button",
"text": {
"type": "plain_text",
"text": "Action Button",
"emoji": false
},
"action_id": "button_action"
}
]
}
""";
assertEquals(JsonParser.parseString(expected), JsonParser.parseString(actual));
}
}