Skip to content

Commit

Permalink
feature: Remove E164Number format validation by default (#41)
Browse files Browse the repository at this point in the history
  • Loading branch information
JPPortier authored Jan 22, 2024
1 parent bf5eb5f commit 5c93bf4
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion client/src/main/com/sinch/sdk/models/E164PhoneNumber.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public class E164PhoneNumber {
"\\d\\d\\d\\d\\d",
// ending with digits
"\\d*$"));
private static final AtomicBoolean STRICT = new AtomicBoolean(true);
private static final AtomicBoolean STRICT = new AtomicBoolean(false);
private final String number;

public E164PhoneNumber(String number) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,10 @@ void valueOf() {
@Test
void throwExceptionOnInvalid() {
String value = "my invalid value";
E164PhoneNumber.setStrict(true);
Exception exception =
assertThrows(NumberFormatException.class, () -> E164PhoneNumber.valueOf(value));
E164PhoneNumber.setStrict(false);
assertTrue(
exception.getMessage().contains(value),
String.format("'%s' should contains '%s'", exception.getMessage(), value));
Expand Down

0 comments on commit 5c93bf4

Please sign in to comment.