-
Notifications
You must be signed in to change notification settings - Fork 2
/
SlackClientTest.java
33 lines (25 loc) · 1.03 KB
/
SlackClientTest.java
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 org.camunda.bpm.example.slack;
import lombok.extern.slf4j.Slf4j;
import org.junit.BeforeClass;
import org.junit.Test;
import java.io.InputStream;
import java.time.LocalDateTime;
import java.util.Properties;
import static org.junit.Assert.assertTrue;
@Slf4j
public class SlackClientTest {
public static Properties properties;
@BeforeClass
public static void setUpBeforeClass() throws Exception {
properties = new Properties();
InputStream propertiesFile = SlackClientTest.class.getClassLoader().getResourceAsStream("application.properties");
properties.load(propertiesFile);
}
@Test
public void testPostMessage() {
SlackClient slackClient = new SlackClient(properties.getProperty("slack.bot.oauth.token"), properties.getProperty("slack.bot.channel"));
String response = slackClient.sendToChannel("Hello from Camunda at " + LocalDateTime.now());
log.info("response: {}", response);
assertTrue(response.contains("warning=null, error=null, needed=null"));
}
}