Skip to content

Commit eb88141

Browse files
committed
EDGE-630 Add tests for generate bxml
1 parent 1af9c06 commit eb88141

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

src/test/java/com/bandwidth/BxmlTest.java

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
package com.bandwidth.voice.bxml.verbs;
2+
import com.bandwidth.webrtc.utils.WebRtcTransfer;
23

34
import org.junit.Test;
45
import org.junit.Before;
@@ -7,6 +8,7 @@
78

89
import java.util.ArrayList;
910

11+
1012
/**
1113
* Unit tests for BXML
1214
*/
@@ -462,4 +464,33 @@ public void testStartGather() {
462464

463465
assertEquals("BXML strings not equal", expected, response);
464466
}
467+
468+
@Test
469+
public void testGenerateBxmlTwoParams() {
470+
String response = WebRtcTransfer.generateBxml("asdf","c-93d6f3c0-be584596-0b74-4fa2-8015-d8ede84bd1a4");
471+
String expected = "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n"
472+
+ "<Response><Transfer>\n"
473+
+ "\t<SipUri uui=\"93d6f3c0be5845960b744fa28015d8ede84bd1a4;encoding=base64,asdf;encoding=jwt\">sip:sipx.webrtc.bandwidth.com:5060</SipUri>\n"
474+
+ "</Transfer></Response>\n";
475+
assertEquals("BXML strings are equal", expected, response);
476+
}
477+
478+
@Test
479+
public void testGenerateBxmlThreeParams() {
480+
String response = WebRtcTransfer.generateBxml("asdf","c-93d6f3c0-be584596-0b74-4fa2-8015-d8ede84bd1a4", "sip1:sipx.webrtc.bandwidth.com:5060");
481+
String expected = "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n"
482+
+ "<Response><Transfer>\n"
483+
+ "\t<SipUri uui=\"93d6f3c0be5845960b744fa28015d8ede84bd1a4;encoding=base64,asdf;encoding=jwt\">sip1:sipx.webrtc.bandwidth.com:5060</SipUri>\n"
484+
+ "</Transfer></Response>\n";
485+
assertEquals("BXML strings are equal", expected, response);
486+
}
487+
488+
@Test
489+
public void testGenerateBxmlVerb() {
490+
String response = WebRtcTransfer.generateTransferVerb("asdf","c-93d6f3c0-be584596-0b74-4fa2-8015-d8ede84bd1a4", "sip:sipx.webrtc.bandwidth.com:5060");
491+
String expected = "<Transfer>\n"
492+
+ "\t<SipUri uui=\"93d6f3c0be5845960b744fa28015d8ede84bd1a4;encoding=base64,asdf;encoding=jwt\">sip:sipx.webrtc.bandwidth.com:5060</SipUri>\n"
493+
+ "</Transfer>";
494+
assertEquals("BXML strings are equal", expected, response);
495+
}
465496
}

0 commit comments

Comments
 (0)