|
18 | 18 | import com.azure.communication.callautomation.models.events.CallConnected;
|
19 | 19 | import com.azure.communication.callautomation.models.events.RecognizeFailed;
|
20 | 20 | import com.azure.communication.callautomation.models.events.RecordingStateChanged;
|
| 21 | +import com.azure.communication.callautomation.models.events.RemoveParticipantFailed; |
| 22 | +import com.azure.communication.callautomation.models.events.RemoveParticipantSucceeded; |
21 | 23 | import com.azure.communication.callautomation.models.events.ReasonCode.Recognize;
|
22 | 24 |
|
23 | 25 | import org.junit.jupiter.api.Test;
|
@@ -260,4 +262,76 @@ public void parseRecognizeCanceledEvent() {
|
260 | 262 | assertNotNull(recognizeCanceledEvent);
|
261 | 263 | assertEquals("serverCallId", recognizeCanceledEvent.getServerCallId());
|
262 | 264 | }
|
| 265 | + |
| 266 | + @Test |
| 267 | + public void parseRemoveParticipantSucceededEvent() { |
| 268 | + String receivedEvent = "[{\n" |
| 269 | + + "\"id\": \"c3220fa3-79bd-473e-96a2-3ecb5be7d71f\",\n" |
| 270 | + + "\"source\": \"calling/callConnections/421f3500-f5de-4c12-bf61-9e2641433687\",\n" |
| 271 | + + "\"type\": \"Microsoft.Communication.RemoveParticipantSucceeded\",\n" |
| 272 | + + "\"data\": {\n" |
| 273 | + + "\"operationContext\": \"context\",\n" |
| 274 | + + "\"participant\": {\n" |
| 275 | + + "\"rawId\": \"rawId\",\n" |
| 276 | + + "\"phoneNumber\": {\n" |
| 277 | + + "\"value\": \"value\"\n" |
| 278 | + + "}\n" |
| 279 | + + "},\n" |
| 280 | + + "\"callConnectionId\": \"callConnectionId\",\n" |
| 281 | + + "\"serverCallId\": \"serverCallId\",\n" |
| 282 | + + "\"correlationId\": \"b880bd5a-1916-470a-b43d-aabf3caff91c\"\n" |
| 283 | + + "},\n" |
| 284 | + + "\"time\": \"2023-03-22T16:57:09.287755+00:00\",\n" |
| 285 | + + "\"specversion\": \"1.0\",\n" |
| 286 | + + "\"datacontenttype\": \"application/json\",\n" |
| 287 | + + "\"subject\": \"calling/callConnections/421f3500-f5de-4c12-bf61-9e2641433687\"\n" |
| 288 | + + "}]"; |
| 289 | + |
| 290 | + CallAutomationEventBase event = EventHandler.parseEvent(receivedEvent); |
| 291 | + |
| 292 | + assertNotNull(event); |
| 293 | + |
| 294 | + RemoveParticipantSucceeded removeParticipantSucceededEvent = (RemoveParticipantSucceeded) event; |
| 295 | + |
| 296 | + assertNotNull(removeParticipantSucceededEvent); |
| 297 | + assertEquals("serverCallId", removeParticipantSucceededEvent.getServerCallId()); |
| 298 | + assertEquals("callConnectionId", removeParticipantSucceededEvent.getCallConnectionId()); |
| 299 | + assertEquals("rawId", removeParticipantSucceededEvent.getParticipant().getRawId()); |
| 300 | + } |
| 301 | + |
| 302 | + @Test |
| 303 | + public void parseRemoveParticipantFailedEvent() { |
| 304 | + String receivedEvent = "[{\n" |
| 305 | + + "\"id\": \"c3220fa3-79bd-473e-96a2-3ecb5be7d71f\",\n" |
| 306 | + + "\"source\": \"calling/callConnections/421f3500-f5de-4c12-bf61-9e2641433687\",\n" |
| 307 | + + "\"type\": \"Microsoft.Communication.RemoveParticipantFailed\",\n" |
| 308 | + + "\"data\": {\n" |
| 309 | + + "\"operationContext\": \"context\",\n" |
| 310 | + + "\"participant\": {\n" |
| 311 | + + "\"rawId\": \"rawId\",\n" |
| 312 | + + "\"phoneNumber\": {\n" |
| 313 | + + "\"value\": \"value\"\n" |
| 314 | + + "}\n" |
| 315 | + + "},\n" |
| 316 | + + "\"callConnectionId\": \"callConnectionId\",\n" |
| 317 | + + "\"serverCallId\": \"serverCallId\",\n" |
| 318 | + + "\"correlationId\": \"b880bd5a-1916-470a-b43d-aabf3caff91c\"\n" |
| 319 | + + "},\n" |
| 320 | + + "\"time\": \"2023-03-22T16:57:09.287755+00:00\",\n" |
| 321 | + + "\"specversion\": \"1.0\",\n" |
| 322 | + + "\"datacontenttype\": \"application/json\",\n" |
| 323 | + + "\"subject\": \"calling/callConnections/421f3500-f5de-4c12-bf61-9e2641433687\"\n" |
| 324 | + + "}]"; |
| 325 | + |
| 326 | + CallAutomationEventBase event = EventHandler.parseEvent(receivedEvent); |
| 327 | + |
| 328 | + assertNotNull(event); |
| 329 | + |
| 330 | + RemoveParticipantFailed removeParticipantFailedEvent = (RemoveParticipantFailed) event; |
| 331 | + |
| 332 | + assertNotNull(removeParticipantFailedEvent); |
| 333 | + assertEquals("serverCallId", removeParticipantFailedEvent.getServerCallId()); |
| 334 | + assertEquals("callConnectionId", removeParticipantFailedEvent.getCallConnectionId()); |
| 335 | + assertEquals("rawId", removeParticipantFailedEvent.getParticipant().getRawId()); |
| 336 | + } |
263 | 337 | }
|
0 commit comments