Skip to content

Commit 8aeb15e

Browse files
committed
Merge branch 'master' of https://github.com/twilio/twilio-java
2 parents 600bc99 + c532dac commit 8aeb15e

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

src/main/java/com/twilio/converter/Promoter.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
package com.twilio.converter;
22

3+
import com.twilio.type.PhoneNumber;
4+
35
import java.net.URI;
46
import java.net.URISyntaxException;
57
import java.util.ArrayList;
@@ -21,6 +23,16 @@ public static URI uriFromString(final String url) {
2123
}
2224
}
2325

26+
/**
27+
* Create a @see com.twilio.types.PhoneNumber from a string
28+
*
29+
* @param pn PhoneNumber to convert
30+
* @return built @see com.twilio.types.PhoneNumber
31+
*/
32+
public static PhoneNumber phoneNumberFromString(final String pn) {
33+
return new PhoneNumber(pn);
34+
}
35+
2436
/**
2537
* Create a list from a single element.
2638
*

src/test/java/com/twilio/converter/PromoterTest.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package com.twilio.converter;
22

33
import com.google.common.collect.Lists;
4+
import com.twilio.type.PhoneNumber;
45
import org.junit.Assert;
56
import org.junit.Test;
67

@@ -20,6 +21,12 @@ public void testPromoteUri() {
2021
);
2122
}
2223

24+
@Test
25+
public void testPhoneNumberFromString() {
26+
PhoneNumber pn = Promoter.phoneNumberFromString("+12345678910");
27+
Assert.assertEquals(new PhoneNumber("+12345678910"), pn);
28+
}
29+
2330
@Test
2431
public void testPromoteList() {
2532
String s = "hi";

0 commit comments

Comments
 (0)