File tree Expand file tree Collapse file tree 2 files changed +41
-2
lines changed
main/java/com/twilio/sdk/verbs
test/java/com/twilio/sdk/verbs Expand file tree Collapse file tree 2 files changed +41
-2
lines changed Original file line number Diff line number Diff line change @@ -8,12 +8,19 @@ public class Sip extends Verb {
88 /**
99 * Instantiates a new Sip.
1010 */
11- public Sip () {
12- super (V_SIP , null );
11+ public Sip (final String uri ) {
12+ super (V_SIP , uri );
1313 this .allowedVerbs = new ArrayList <String >();
1414 this .allowedVerbs .add (Verb .V_URI );
1515 }
1616
17+ /**
18+ * Instantiates a new Sip Noun with no URI.
19+ */
20+ public Sip () {
21+ this (null );
22+ }
23+
1724 public void setUsername (String username ) {
1825 this .set ("username" , username );
1926 }
Original file line number Diff line number Diff line change 1+ package com .twilio .sdk .verbs ;
2+
3+ import org .junit .Test ;
4+
5+ import static org .junit .Assert .assertEquals ;
6+
7+ public class SipTest {
8+
9+ /**
10+ * Test the SIP noun with a text element representing the URI.
11+ */
12+ @ Test
13+ public void testBasicSip () {
14+ Sip sip = new Sip ("sip:alice@twilio.com;transport=udp" );
15+ assertEquals ("<Sip>sip:alice@twilio.com;transport=udp</Sip>" , sip .toXML ());
16+ }
17+
18+ /**
19+ * Test the SIP noun with a child URI noun.
20+ * @throws TwiMLException
21+ */
22+ @ Test
23+ public void testSipUriNoun () throws TwiMLException {
24+ Sip sip = new Sip ();
25+ Uri uri = new Uri ("sip:alice@twilio.com;transport=udp" );
26+ uri .setUsername ("alice" );
27+ uri .setPassword ("hellotwilio" );
28+ sip .append (uri );
29+ assertEquals ("<Sip><Uri username=\" alice\" password=\" hellotwilio\" >sip:alice@twilio.com;transport=udp</Uri></Sip>" ,
30+ sip .toXML ());
31+ }
32+ }
You can’t perform that action at this time.
0 commit comments