forked from ringcentral/ringcentral-java
-
Notifications
You must be signed in to change notification settings - Fork 0
/
SmsTest.java
25 lines (20 loc) · 1023 Bytes
/
SmsTest.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
package com.ringcentral;
import com.ringcentral.definitions.CreateSMSMessage;
import com.ringcentral.definitions.MessageInfo;
import com.ringcentral.definitions.MessageStoreCallerInfoRequest;
import org.junit.Test;
import java.io.IOException;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
public class SmsTest extends BaseTest {
@Test
public void sendSms() throws IOException, RestException {
CreateSMSMessage postParameters = new CreateSMSMessage();
postParameters.from = new MessageStoreCallerInfoRequest().phoneNumber(config.get("username"));
postParameters.to = new MessageStoreCallerInfoRequest[]{new MessageStoreCallerInfoRequest().phoneNumber(config.get("receiver"))};
postParameters.text = "hello world";
MessageInfo messageInfo = restClient.post("/restapi/v1.0/account/~/extension/~/sms", postParameters, MessageInfo.class);
assertNotNull(messageInfo);
assertEquals("SMS", messageInfo.type);
}
}