-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathStartStreamVerbTest.java
More file actions
57 lines (48 loc) · 2.2 KB
/
StartStreamVerbTest.java
File metadata and controls
57 lines (48 loc) · 2.2 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
/**
*
* Unit tests for StartStream Verb class
*
*
* @throws JAXBException if the test fails
*/
package com.bandwidth.sdk.unit.models.bxml;
import com.bandwidth.sdk.model.CallDirectionEnum;
import com.bandwidth.sdk.model.bxml.Bxml;
import com.bandwidth.sdk.model.bxml.StartStream;
import com.bandwidth.sdk.model.bxml.StreamParam;
import jakarta.xml.bind.JAXBContext;
import jakarta.xml.bind.JAXBException;
import org.junit.jupiter.api.Test;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.is;
import java.util.List;
public class StartStreamVerbTest {
/**
* Setting up Variables
*/
StreamParam streamParam1 = StreamParam.builder()
.name("name1")
.value("value1")
.build();
StreamParam streamParam2 = StreamParam.builder()
.name("name2")
.value("value2")
.build();
StartStream startStream = StartStream.builder()
.name("stream1")
.mode("unidirectional")
.tracks(CallDirectionEnum.INBOUND)
.destination("testurl.com")
.streamEventUrl("eventurl.com")
.streamEventMethod("POST")
.username("user")
.password("pass")
.streamParams(List.of(streamParam1, streamParam2))
.build();
@Test
public void startStreamVerbWorks() throws JAXBException {
JAXBContext jaxbContext = JAXBContext.newInstance(Bxml.class);
String expectedBxml = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><Bxml><StartStream name=\"stream1\" mode=\"unidirectional\" tracks=\"INBOUND\" destination=\"testurl.com\" streamEventUrl=\"eventurl.com\" streamEventMethod=\"POST\" username=\"user\" password=\"pass\"><StreamParam name=\"name1\" value=\"value1\"/><StreamParam name=\"name2\" value=\"value2\"/></StartStream></Bxml>";
assertThat(new Bxml().with(startStream).toBxml(jaxbContext), is(expectedBxml));
}
};