-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathContextTest.java
More file actions
33 lines (30 loc) · 1013 Bytes
/
ContextTest.java
File metadata and controls
33 lines (30 loc) · 1013 Bytes
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
package blocks;
import static org.junit.jupiter.api.Assertions.assertEquals;
import com.google.gson.JsonParser;
import com.slack.api.model.block.ContextBlock;
import com.slack.api.util.json.GsonFactory;
import org.junit.jupiter.api.Test;
public class ContextTest {
@Test
public void testExample01() {
ContextBlock block = Context.example01();
String actual = GsonFactory.createSnakeCase().toJson(block);
String expected = """
{
"type": "context",
"elements": [
{
"type": "image",
"image_url": "https://image.freepik.com/free-photo/red-drawing-pin_1156-445.jpg",
"alt_text": "images"
},
{
"type": "mrkdwn",
"text": "Location: **Dogpatch**"
}
]
}
""";
assertEquals(JsonParser.parseString(expected), JsonParser.parseString(actual));
}
}