forked from ringcentral/ringcentral-java
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDictionaryTest.java
More file actions
159 lines (124 loc) · 5 KB
/
DictionaryTest.java
File metadata and controls
159 lines (124 loc) · 5 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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
package com.ringcentral;
import com.ringcentral.definitions.*;
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import java.io.IOException;
public class DictionaryTest {
private RestClient rc;
@Before
public void setUp() throws RestException, IOException {
rc = new RestClient(System.getenv("RINGCENTRAL_CLIENT_ID"),
System.getenv("RINGCENTRAL_CLIENT_SECRET"),
System.getenv("RINGCENTRAL_SERVER_URL"));
rc.authorize(System.getenv("RINGCENTRAL_JWT_TOKEN"));
}
@After
public void revokeAccessToken() throws RestException, IOException {
rc.revoke();
}
@Test
public void testGetCountry() throws IOException, RestException {
CountryInfoDictionaryModel c =
rc.restapi().dictionary().country("46").get();
Assert.assertEquals("China", c.name);
}
@Test
public void testListCountry() throws IOException, RestException {
CountryListDictionaryModel r =
rc.restapi().dictionary().country().list();
Assert.assertTrue(r.records.length > 0);
}
@Test
public void testListState() throws RestException, IOException {
GetStateListResponse getStateListResponse =
rc.restapi().dictionary().state().list();
Assert.assertTrue(getStateListResponse.records.length > 0);
}
@Test
public void testGetState() throws RestException, IOException {
GetStateInfoResponse getStateInfoResponse =
rc.restapi().dictionary().state("13").get();
Assert.assertEquals("Alaska", getStateInfoResponse.name);
}
@Test
public void testlistTimeZone() throws RestException, IOException {
GetTimezoneListResponse
getTimezoneListResponse =
rc.restapi().dictionary().timezone().list();
Assert.assertTrue(getTimezoneListResponse.records.length > 0);
}
@Test
public void testGetTimeZone() throws RestException, IOException {
GetTimezoneInfoResponse getTimezoneInfoResponse =
rc.restapi().dictionary().timezone("2").get();
Assert.assertEquals("Europe/Lisbon", getTimezoneInfoResponse.name);
}
@Test
public void testlistUserRole() throws RestException, IOException {
RolesCollectionResource rolesCollectionResource =
rc.restapi().dictionary().userRole().list();
Assert.assertTrue(rolesCollectionResource.records.length > 0);
}
@Test
public void testGetUserRole() throws RestException, IOException {
RoleResource roleResource =
rc.restapi().dictionary().userRole("8").get();
Assert.assertEquals("Manager", roleResource.displayName);
}
@Test
public void testlistPermission() throws RestException, IOException {
PermissionCollectionResource
permissionCollectionResource =
rc.restapi().dictionary().permission().list();
Assert.assertTrue(permissionCollectionResource.records.length > 0);
}
@Test
public void testGetPermission() throws RestException, IOException {
PermissionResource permissionResource =
rc.restapi().dictionary().permission("AccountAdministration").get();
Assert.assertEquals("Account Administration",
permissionResource.displayName);
}
@Test
public void testlistPermissionCategory() throws RestException, IOException {
PermissionCategoryCollectionResource
permissionCategoryCollectionResource =
rc.restapi().dictionary().permissionCategory().list();
Assert.assertTrue(
permissionCategoryCollectionResource.records.length > 0);
}
@Test
public void testGetPermissionCategory() throws RestException, IOException {
PermissionCategoryResource permissionCategoryResource =
rc.restapi().dictionary().permissionCategory("Analytics").get();
Assert.assertEquals("Analytics",
permissionCategoryResource.displayName);
}
@Test
public void testListLanguage() throws RestException, IOException {
LanguageList
languageList = rc.restapi().dictionary().language().list();
Assert.assertTrue(languageList.records.length > 0);
}
@Test
public void testGetLanguage() throws RestException, IOException {
LanguageInfo languageInfo =
rc.restapi().dictionary().language("1041").get();
Assert.assertEquals("Japanese", languageInfo.name);
}
@Test
public void testListGreeting() throws RestException, IOException {
DictionaryGreetingList
dictionaryGreetingList =
rc.restapi().dictionary().greeting().list();
Assert.assertTrue(dictionaryGreetingList.records.length > 0);
}
@Test
public void testGetGreeting() throws RestException, IOException {
DictionaryGreetingInfo dictionaryGreetingInfo =
rc.restapi().dictionary().greeting("66320").get();
Assert.assertEquals("World", dictionaryGreetingInfo.name);
}
}