Skip to content

Commit 14adad1

Browse files
Fixed AnswerCall Attribute Of Ring BXML Verb
Changed the answerCall field of the Ring class from a boolean primitive to a Boolean wrapper for a default 'null' value if not explicitly set. Otherwise, the boolean primitive would default to 'true' and the attribute would be serialized as such, even if the value wasn't set. Also added a test to assert values that aren't set aren't serialized into the BXML.
1 parent 5d50582 commit 14adad1

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

src/main/java/com/bandwidth/voice/bxml/verbs/Ring.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,5 +25,5 @@ public class Ring implements Verb {
2525
* incoming call. Default value is 'true'.
2626
*/
2727
@XmlAttribute
28-
private boolean answerCall;
28+
private Boolean answerCall;
2929
}

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

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ public void testNestedGatherMultipleVerbs() {
165165

166166
assertEquals("BXML strings not equal", expected, response);
167167
}
168-
168+
169169
@Test
170170
public void testNestedGatherSingleVerb() {
171171
SpeakSentence speakSentence = SpeakSentence.builder()
@@ -442,6 +442,16 @@ public void testRing() {
442442
assertEquals("BXML strings not equal", expected, response);
443443
}
444444

445+
@Test
446+
public void testRingDefault() {
447+
Ring ring = Ring.builder().build();
448+
String response = new Response().add(ring).toBXML();
449+
450+
String expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><Response><Ring/></Response>";
451+
452+
assertEquals("BXML strings not equal", expected, response);
453+
}
454+
445455
@Test
446456
public void testStopGather() {
447457
StopGather stopGather = StopGather.builder().build();

0 commit comments

Comments
 (0)