Skip to content

Commit

Permalink
Fixed AnswerCall Attribute Of Ring BXML Verb
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
abaldwin-Bandwidth committed Oct 28, 2021
1 parent 5d50582 commit 14adad1
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/main/java/com/bandwidth/voice/bxml/verbs/Ring.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,5 @@ public class Ring implements Verb {
* incoming call. Default value is 'true'.
*/
@XmlAttribute
private boolean answerCall;
private Boolean answerCall;
}
12 changes: 11 additions & 1 deletion src/test/java/com/bandwidth/BxmlTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ public void testNestedGatherMultipleVerbs() {

assertEquals("BXML strings not equal", expected, response);
}

@Test
public void testNestedGatherSingleVerb() {
SpeakSentence speakSentence = SpeakSentence.builder()
Expand Down Expand Up @@ -442,6 +442,16 @@ public void testRing() {
assertEquals("BXML strings not equal", expected, response);
}

@Test
public void testRingDefault() {
Ring ring = Ring.builder().build();
String response = new Response().add(ring).toBXML();

String expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><Response><Ring/></Response>";

assertEquals("BXML strings not equal", expected, response);
}

@Test
public void testStopGather() {
StopGather stopGather = StopGather.builder().build();
Expand Down

0 comments on commit 14adad1

Please sign in to comment.