Commits

jia....@ee073f10-1060-11df-b6a4-87a95322a99c  committed 0a97094

separate unittests to test directory; modified build.xml

  • Participants
  • Parent commits a81e1f3
  • Branches default

Comments (0)

Files changed (10)

File java/build.xml

 
 <project name="libphonenumber" default="compile"> 
   <property name="src.dir" value="src"/>
+  <property name="test.dir" value="test"/>
   <property name="build.dir" value="build"/>
   <property name="classes.dir" value="${build.dir}/classes"/>
   <property name="jar.dir" value="${build.dir}/jar"/>
   <target name="compile" description="Compile Java source.">
     <mkdir dir="${classes.dir}"/>
     <javac srcdir="${src.dir}" destdir="${classes.dir}" classpathref="classpath"/>
+    <javac srcdir="${test.dir}" destdir="${classes.dir}" classpathref="classpath"/>
   </target>
 
   <target name="jar" depends="compile">
         <include name="**/*.class"/>
         <exclude name="**/*Test*"/>
       </fileset>
-      <fileset dir="${src.dir}">
+      <fileset dir="${test.dir}">
         <include name="**/PhoneNumberMetadataProtoForTesting"/>
       </fileset>
     </jar>
       <classpath refid="test.classpath"/>
       <formatter type="xml"/>      
       <batchtest fork="no" todir="${report.dir}">
-        <fileset dir="${src.dir}" includes="**/*Test.java"/>
+        <fileset dir="${test.dir}" includes="**/*Test.java"/>
       </batchtest>
     </junit>
   </target>

File java/src/com/google/i18n/phonenumbers/AsYouTypeFormatterTest.java

-/*
- * Copyright (C) 2009 Google Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.google.i18n.phonenumbers;
-
-import junit.framework.TestCase;
-
-import java.io.InputStream;
-
-/**
- * Unit tests for PhoneNumberUtil.java
- *
- * Note that these tests use the metadata contained in the file specified by TEST_META_DATA_FILE,
- * not the normal metadata file, so should not be used for regression test purposes - these tests
- * are illustrative only and test functionality.
- *
- * @author Shaopeng Jia
- */
-public class AsYouTypeFormatterTest extends TestCase {
-  private PhoneNumberUtil phoneUtil;
-  private static final String TEST_META_DATA_FILE =
-      "/com/google/i18n/phonenumbers/PhoneNumberMetadataProtoForTesting";
-
-  public AsYouTypeFormatterTest() {
-   PhoneNumberUtil.resetInstance();
-    InputStream in = PhoneNumberUtilTest.class.getResourceAsStream(TEST_META_DATA_FILE);
-    phoneUtil = PhoneNumberUtil.getInstance(in);
-  }
-
-  public void testAsYouTypeFormatterUS() {
-    AsYouTypeFormatter formatter = phoneUtil.getAsYouTypeFormatter("US");
-    assertEquals("6", formatter.inputDigit('6'));
-    assertEquals("65", formatter.inputDigit('5'));
-    assertEquals("650", formatter.inputDigit('0'));
-    assertEquals("6502", formatter.inputDigit('2'));
-    assertEquals("65025", formatter.inputDigit('5'));
-    assertEquals("650 253 \u2008\u2008\u2008\u2008", formatter.inputDigit('3'));
-    assertEquals("650 253 2\u2008\u2008\u2008", formatter.inputDigit('2'));
-    assertEquals("650 253 22\u2008\u2008", formatter.inputDigit('2'));
-    assertEquals("650 253 222\u2008", formatter.inputDigit('2'));
-    assertEquals("650 253 2222", formatter.inputDigit('2'));
-
-    formatter.clear();
-    assertEquals("6", formatter.inputDigit('6'));
-    assertEquals("65", formatter.inputDigit('5'));
-    assertEquals("650", formatter.inputDigit('0'));
-    assertEquals("6502", formatter.inputDigit('2'));
-    assertEquals("65025", formatter.inputDigit('5'));
-    assertEquals("650 253 \u2008\u2008\u2008\u2008", formatter.inputDigit('3'));
-    assertEquals("650 253 2\u2008\u2008\u2008", formatter.inputDigit('2'));
-    assertEquals("650 253 22\u2008\u2008", formatter.inputDigit('2'));
-    assertEquals("650 253 222\u2008", formatter.inputDigit('2'));
-    assertEquals("650 253 2222", formatter.inputDigit('2'));
-
-    formatter.clear();
-    assertEquals("6", formatter.inputDigit('6'));
-    assertEquals("65", formatter.inputDigit('5'));
-    assertEquals("650", formatter.inputDigit('0'));
-    assertEquals("650-", formatter.inputDigit('-'));
-    assertEquals("650-2", formatter.inputDigit('2'));
-    assertEquals("650-25", formatter.inputDigit('5'));
-    assertEquals("650 253 \u2008\u2008\u2008\u2008", formatter.inputDigit('3'));
-    assertEquals("650 253 \u2008\u2008\u2008\u2008", formatter.inputDigit('-'));
-    assertEquals("650 253 2\u2008\u2008\u2008", formatter.inputDigit('2'));
-    assertEquals("650 253 22\u2008\u2008", formatter.inputDigit('2'));
-    assertEquals("650 253 222\u2008", formatter.inputDigit('2'));
-    assertEquals("650 253 2222", formatter.inputDigit('2'));
-
-    formatter.clear();
-    assertEquals("0", formatter.inputDigit('0'));
-    assertEquals("01", formatter.inputDigit('1'));
-    assertEquals("011", formatter.inputDigit('1'));
-    assertEquals("0114", formatter.inputDigit('4'));
-    assertEquals("01148", formatter.inputDigit('8'));
-    assertEquals("011 48 8", formatter.inputDigit('8'));
-    assertEquals("011 48 88", formatter.inputDigit('8'));
-    assertEquals("011 48 881", formatter.inputDigit('1'));
-    assertEquals("011 48 88 12\u2008 \u2008\u2008 \u2008\u2008", formatter.inputDigit('2'));
-    assertEquals("011 48 88 123 \u2008\u2008 \u2008\u2008", formatter.inputDigit('3'));
-    assertEquals("011 48 88 123 1\u2008 \u2008\u2008", formatter.inputDigit('1'));
-    assertEquals("011 48 88 123 12 \u2008\u2008", formatter.inputDigit('2'));
-    assertEquals("011 48 88 123 12 1\u2008", formatter.inputDigit('1'));
-    assertEquals("011 48 88 123 12 12", formatter.inputDigit('2'));
-
-    formatter.clear();
-    assertEquals("0", formatter.inputDigit('0'));
-    assertEquals("01", formatter.inputDigit('1'));
-    assertEquals("011", formatter.inputDigit('1'));
-    assertEquals("0114", formatter.inputDigit('4'));
-    assertEquals("01144", formatter.inputDigit('4'));
-    assertEquals("011 44 6", formatter.inputDigit('6'));
-    assertEquals("011 44 61", formatter.inputDigit('1'));
-    assertEquals("011 44 612", formatter.inputDigit('2'));
-    assertEquals("011 44 6 123 \u2008\u2008\u2008 \u2008\u2008\u2008", formatter.inputDigit('3'));
-    assertEquals("011 44 6 123 1\u2008\u2008 \u2008\u2008\u2008", formatter.inputDigit('1'));
-    assertEquals("011 44 6 123 12\u2008 \u2008\u2008\u2008", formatter.inputDigit('2'));
-    assertEquals("011 44 6 123 123 \u2008\u2008\u2008", formatter.inputDigit('3'));
-    assertEquals("011 44 6 123 123 1\u2008\u2008", formatter.inputDigit('1'));
-    assertEquals("011 44 6 123 123 12\u2008", formatter.inputDigit('2'));
-    assertEquals("011 44 6 123 123 123", formatter.inputDigit('3'));
-
-    formatter.clear();
-    assertEquals("+", formatter.inputDigit('+'));
-    assertEquals("+1", formatter.inputDigit('1'));
-    assertEquals("+16", formatter.inputDigit('6'));
-    assertEquals("+165", formatter.inputDigit('5'));
-    assertEquals("+1650", formatter.inputDigit('0'));
-    assertEquals("+1 650 2\u2008\u2008 \u2008\u2008\u2008\u2008", formatter.inputDigit('2'));
-    assertEquals("+1 650 25\u2008 \u2008\u2008\u2008\u2008", formatter.inputDigit('5'));
-    assertEquals("+1 650 253 \u2008\u2008\u2008\u2008", formatter.inputDigit('3'));
-    assertEquals("+1 650 253 2\u2008\u2008\u2008", formatter.inputDigit('2'));
-    assertEquals("+1 650 253 22\u2008\u2008", formatter.inputDigit('2'));
-    assertEquals("+1 650 253 222\u2008", formatter.inputDigit('2'));
-
-    formatter.clear();
-    assertEquals("+", formatter.inputDigit('+'));
-    assertEquals("+4", formatter.inputDigit('4'));
-    assertEquals("+48", formatter.inputDigit('8'));
-    assertEquals("+488", formatter.inputDigit('8'));
-    assertEquals("+4888", formatter.inputDigit('8'));
-    assertEquals("+48 881", formatter.inputDigit('1'));
-    assertEquals("+48 88 12\u2008 \u2008\u2008 \u2008\u2008", formatter.inputDigit('2'));
-    assertEquals("+48 88 123 \u2008\u2008 \u2008\u2008", formatter.inputDigit('3'));
-    assertEquals("+48 88 123 1\u2008 \u2008\u2008", formatter.inputDigit('1'));
-    assertEquals("+48 88 123 12 \u2008\u2008", formatter.inputDigit('2'));
-    assertEquals("+48 88 123 12 1\u2008", formatter.inputDigit('1'));
-    assertEquals("+48 88 123 12 12", formatter.inputDigit('2'));
-
-    // Test US number with full-width characters.
-    formatter.clear();
-    assertEquals("\uFF16", formatter.inputDigit('\uFF16'));
-    assertEquals("\uFF16\uFF15", formatter.inputDigit('\uFF15'));
-    assertEquals("\uFF16\uFF15\uFF10", formatter.inputDigit('\uFF10'));
-    assertEquals("\uFF16\uFF15\uFF10\uFF12", formatter.inputDigit('\uFF12'));
-    assertEquals("\uFF16\uFF15\uFF10\uFF12\uFF15", formatter.inputDigit('\uFF15'));
-    assertEquals("650 253 \u2008\u2008\u2008\u2008", formatter.inputDigit('\uFF13'));
-    assertEquals("650 253 2\u2008\u2008\u2008", formatter.inputDigit('\uFF12'));
-    assertEquals("650 253 22\u2008\u2008", formatter.inputDigit('\uFF12'));
-    assertEquals("650 253 222\u2008", formatter.inputDigit('\uFF12'));
-    assertEquals("650 253 2222", formatter.inputDigit('\uFF12'));
-
-    // Mobile short code.
-    formatter.clear();
-    assertEquals("*", formatter.inputDigit('*'));
-    assertEquals("*1", formatter.inputDigit('1'));
-    assertEquals("*12", formatter.inputDigit('2'));
-    assertEquals("*121", formatter.inputDigit('1'));
-    assertEquals("*121#", formatter.inputDigit('#'));
-  }
-
-  public void testAsYouTypeFormatterGBFixedLine() {
-    AsYouTypeFormatter formatter = phoneUtil.getAsYouTypeFormatter("GB");
-    assertEquals("0", formatter.inputDigit('0'));
-    assertEquals("02", formatter.inputDigit('2'));
-    assertEquals("020", formatter.inputDigit('0'));
-    assertEquals("0207", formatter.inputDigit('7'));
-    assertEquals("02070", formatter.inputDigit('0'));
-    assertEquals("020 703\u2008 \u2008\u2008\u2008\u2008", formatter.inputDigit('3'));
-    assertEquals("020 7031 \u2008\u2008\u2008\u2008", formatter.inputDigit('1'));
-    assertEquals("020 7031 3\u2008\u2008\u2008", formatter.inputDigit('3'));
-    assertEquals("020 7031 30\u2008\u2008", formatter.inputDigit('0'));
-    assertEquals("020 7031 300\u2008", formatter.inputDigit('0'));
-    assertEquals("020 7031 3000", formatter.inputDigit('0'));
-  }
-
-  public void testAsYouTypeFormatterGBTollFree() {
-    AsYouTypeFormatter formatter = phoneUtil.getAsYouTypeFormatter("GB");
-    assertEquals("0", formatter.inputDigit('0'));
-    assertEquals("08", formatter.inputDigit('8'));
-    assertEquals("080", formatter.inputDigit('0'));
-    assertEquals("0807", formatter.inputDigit('7'));
-    assertEquals("08070", formatter.inputDigit('0'));
-    assertEquals("080 703\u2008 \u2008\u2008\u2008\u2008", formatter.inputDigit('3'));
-    assertEquals("080 7031 \u2008\u2008\u2008\u2008", formatter.inputDigit('1'));
-    assertEquals("080 7031 3\u2008\u2008\u2008", formatter.inputDigit('3'));
-    assertEquals("080 7031 30\u2008\u2008", formatter.inputDigit('0'));
-    assertEquals("080 7031 300\u2008", formatter.inputDigit('0'));
-    assertEquals("080 7031 3000", formatter.inputDigit('0'));
-  }
-
-  public void testAsYouTypeFormatterGBPremiumRate() {
-    AsYouTypeFormatter formatter = phoneUtil.getAsYouTypeFormatter("GB");
-    assertEquals("0", formatter.inputDigit('0'));
-    assertEquals("09", formatter.inputDigit('9'));
-    assertEquals("090", formatter.inputDigit('0'));
-    assertEquals("0907", formatter.inputDigit('7'));
-    assertEquals("09070", formatter.inputDigit('0'));
-    assertEquals("090 703\u2008 \u2008\u2008\u2008\u2008", formatter.inputDigit('3'));
-    assertEquals("090 7031 \u2008\u2008\u2008\u2008", formatter.inputDigit('1'));
-    assertEquals("090 7031 3\u2008\u2008\u2008", formatter.inputDigit('3'));
-    assertEquals("090 7031 30\u2008\u2008", formatter.inputDigit('0'));
-    assertEquals("090 7031 300\u2008", formatter.inputDigit('0'));
-    assertEquals("090 7031 3000", formatter.inputDigit('0'));
-  }
-
-  public void testAsYouTypeFormatterNZMobile() {
-    AsYouTypeFormatter formatter = phoneUtil.getAsYouTypeFormatter("NZ");
-    assertEquals("0", formatter.inputDigit('0'));
-    assertEquals("02", formatter.inputDigit('2'));
-    assertEquals("021", formatter.inputDigit('1'));
-    assertEquals("0211", formatter.inputDigit('1'));
-    assertEquals("02112", formatter.inputDigit('2'));
-    assertEquals("021123", formatter.inputDigit('3'));
-    assertEquals("0211234", formatter.inputDigit('4'));
-    assertEquals("02112345", formatter.inputDigit('5'));
-    assertEquals("021123456", formatter.inputDigit('6'));
-  }
-
-  public void testAsYouTypeFormatterDE() {
-    AsYouTypeFormatter formatter = phoneUtil.getAsYouTypeFormatter("DE");
-    assertEquals("0", formatter.inputDigit('0'));
-    assertEquals("03", formatter.inputDigit('3'));
-    assertEquals("030", formatter.inputDigit('0'));
-    assertEquals("0301", formatter.inputDigit('1'));
-    assertEquals("03012", formatter.inputDigit('2'));
-    assertEquals("030123", formatter.inputDigit('3'));
-    assertEquals("0301234", formatter.inputDigit('4'));
-  }
-}

File java/src/com/google/i18n/phonenumbers/PhoneNumberMetaDataForTesting.xml

-<!-- Copyright (C) 2009 Google Inc.
-
-     Licensed under the Apache License, Version 2.0 (the "License");
-     you may not use this file except in compliance with the License.
-     You may obtain a copy of the License at
-
-     http://www.apache.org/licenses/LICENSE-2.0
-
-     Unless required by applicable law or agreed to in writing, software
-     distributed under the License is distributed on an "AS IS" BASIS,
-     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-     See the License for the specific language governing permissions and
-     limitations under the License.
-
-     @author: Shaopeng Jia
-
-     MetaData on Phone Number Plan and formatting rules. This file is used
-     solely for the purpose of unittesting, so data in this file is not
-     necessarily consistent with that of PhoneNumberMetaData.xml
--->
-
-<phoneNumberMetadata>
-  <territories>
-    <!-- Andorra -->
-    <territory id="AD" countryCode="376" internationalPrefix="00">
-    </territory>
-
-    <!-- Argentina -->
-    <territory id="AR" countryCode="54" internationalPrefix="00"
-               nationalPrefix="0" nationalPrefixFormattingRule="$NP$FG"
-               nationalPrefixForParsing="0(?:(11|343|3715)15)?"
-               nationalPrefixTransformRule="9$1">
-      <!-- Note in nationalPrefixForParsing, the areacode (such as 11, 343, etc.), when present in
-           front of carrier selection code 15, is captured to replace $1 in
-           nationalPrefixTransformRule -->
-      <availableFormats>
-        <numberFormat leadingDigits="11" pattern="(\d{2})(\d{4})(\d{4})">$1 $2-$3</numberFormat>
-        <numberFormat leadingDigits="1[02-9]|[23]" pattern="(\d{4})(\d{2})(\d{4})">$1 $2-$3</numberFormat>
-        <numberFormat leadingDigits="911" pattern="9(11)(\d{4})(\d{4})">$1 15 $2-$3</numberFormat>
-        <numberFormat leadingDigits="9(?:1[02-9]|[23])" pattern="9(\d{4})(\d{2})(\d{4})">$1 15 $2-$3</numberFormat>
-        <numberFormat leadingDigits="[68]" pattern="(\d{3})(\d{3})(\d{4})">$1-$2-$3</numberFormat>
-        <intlNumberFormat leadingDigits="11" pattern="(\d{2})(\d{4})(\d{4})">$1 $2-$3</intlNumberFormat>
-        <intlNumberFormat leadingDigits="1[02-9]|[23]" pattern="(\d{4})(\d{2})(\d{4})">$1 $2-$3</intlNumberFormat>
-        <intlNumberFormat leadingDigits="911" pattern="(9)(11)(\d{4})(\d{4})">$1 $2 $3 $4</intlNumberFormat>
-        <intlNumberFormat leadingDigits="9(?:1[02-9]|[23])" pattern="(9)(\d{4})(\d{2})(\d{4})">$1 $2 $3 $4</intlNumberFormat>
-        <intlNumberFormat leadingDigits="[68]" pattern="(\d{3})(\d{3})(\d{4})">$1-$2-$3</intlNumberFormat>
-      </availableFormats>
-      <generalDesc>
-        <nationalNumberPattern>[1-3689]\d{9,10}</nationalNumberPattern>
-        <possibleNumberPattern>\d{6,11}</possibleNumberPattern>
-      </generalDesc>
-      <fixedLine>
-         <nationalNumberPattern>[1-3]\d{9}</nationalNumberPattern>
-         <possibleNumberPattern>\d{6,10}</possibleNumberPattern>
-      </fixedLine>
-      <mobile>
-        <nationalNumberPattern>9\d{10}|[1-3]\d{9}</nationalNumberPattern>
-        <possibleNumberPattern>\d{10,11}</possibleNumberPattern>
-      </mobile>
-      <tollFree>
-        <nationalNumberPattern>80\d{8}</nationalNumberPattern>
-        <possibleNumberPattern>\d{10}</possibleNumberPattern>
-      </tollFree>
-      <premiumRate>
-        <nationalNumberPattern>6(0\d|10)\d{7}</nationalNumberPattern>
-        <possibleNumberPattern>\d{10}</possibleNumberPattern>
-      </premiumRate>
-    </territory>
-
-    <!-- Australia -->
-    <territory id="AU" countryCode="61" internationalPrefix="001[12]"
-               nationalPrefix="0" preferredInternationalPrefix="0011"
-               nationalPrefixFormattingRule="$NP$FG">
-      <availableFormats>
-        <numberFormat nationalPrefixFormattingRule="$FG" leadingDigits="1" pattern="(\d{4})(\d{3})(\d{3})">$1 $2 $3</numberFormat>
-        <numberFormat leadingDigits="[2-478]" pattern="(\d{1})(\d{4})(\d{4})">$1 $2 $3</numberFormat>
-      </availableFormats>
-      <generalDesc >
-        <nationalNumberPattern>[1-578]\d{4,14}</nationalNumberPattern>
-        <possibleNumberPattern>\d{5,15}</possibleNumberPattern>
-      </generalDesc>
-      <fixedLine>
-        <nationalNumberPattern>[2378]\d{8}</nationalNumberPattern>
-        <possibleNumberPattern>\d{9}</possibleNumberPattern>
-      </fixedLine>
-      <mobile>
-        <nationalNumberPattern>4\d{8}</nationalNumberPattern>
-        <possibleNumberPattern>\d{9}</possibleNumberPattern>
-      </mobile>
-      <tollFree>
-        <nationalNumberPattern>1800\d{6}</nationalNumberPattern>
-        <possibleNumberPattern>\d{10}</possibleNumberPattern>
-      </tollFree>
-      <premiumRate>
-        <nationalNumberPattern>190[0126]\d{6}</nationalNumberPattern>
-        <possibleNumberPattern>\d{10}</possibleNumberPattern>
-      </premiumRate>
-    </territory>
-
-    <!-- Bahamas -->
-    <territory id="BS" countryCode="1" internationalPrefix="011">
-      <availableFormats>
-        <numberFormat pattern="(\d{3})(\d{3})(\d{4})">$1 $2 $3</numberFormat>
-      </availableFormats>
-      <generalDesc>
-        <nationalNumberPattern>(242|8(00|66|77|88)|900)\d{7}</nationalNumberPattern>
-        <possibleNumberPattern>\d{7,10}</possibleNumberPattern>
-      </generalDesc>
-      <fixedLine>
-        <nationalNumberPattern>242(?:3(?:02|[236][1-9]|4[0-24-9]|5[0-68]|7[3-57]|9[2-5])|4(?:2[237]|51|64|77)|502|636|702)\d{4}</nationalNumberPattern>
-      </fixedLine>
-      <mobile>
-        <nationalNumberPattern>242(357|359|457|557)\d{4}</nationalNumberPattern>
-        <possibleNumberPattern>\d{10}</possibleNumberPattern>
-      </mobile>
-      <tollFree>
-        <nationalNumberPattern>8(00|66|77|88)\d{7}</nationalNumberPattern>
-        <possibleNumberPattern>\d{10}</possibleNumberPattern>
-      </tollFree>
-      <premiumRate>
-        <nationalNumberPattern>900\d{7}</nationalNumberPattern>
-        <possibleNumberPattern>\d{10}</possibleNumberPattern>
-      </premiumRate>
-    </territory>
-
-    <!-- Germany -->
-    <territory id="DE" countryCode="49" internationalPrefix="00"
-               nationalPrefix="0" nationalPrefixFormattingRule="$NP$FG">
-      <availableFormats>
-        <numberFormat leadingDigits="2|3[3-9]|906|[4-9][1-9]1" pattern="(\d{3})(\d{3,8})">$1 $2</numberFormat>
-        <numberFormat leadingDigits="[34]0|[68]9" pattern="(\d{2})(\d{4,9})">$1 $2</numberFormat>
-        <numberFormat leadingDigits="[4-9]" pattern="([4-9]\d{3})(\d{2,7})">$1 $2</numberFormat>
-        <numberFormat leadingDigits="800" pattern="(\d{3})(\d{1})(\d{6})">$1 $2 $3</numberFormat>
-        <numberFormat leadingDigits="900[135]" pattern="(\d{3})(\d{3})(d{4})">$1 $2 $3</numberFormat>
-        <numberFormat leadingDigits="9009" pattern="(\d{3})(\d{4})(\d{4})">$1 $2 $3</numberFormat>
-      </availableFormats>
-      <generalDesc>
-        <nationalNumberPattern>\d{4,14}</nationalNumberPattern>
-        <possibleNumberPattern>\d{2,14}</possibleNumberPattern>
-      </generalDesc>
-      <fixedLine>
-        <nationalNumberPattern>(?:[24-6]\d{2}|3[03-9]\d|[789](?:[1-9]\d|0[2-9]))\d{3,8}</nationalNumberPattern>
-        <exampleNumber>30123456</exampleNumber>
-      </fixedLine>
-      <mobile>
-        <nationalNumberPattern>1(5\d{9}|7\d{8}|6[02]\d{8}|63\d{7})</nationalNumberPattern>
-        <possibleNumberPattern>\d{10,11}</possibleNumberPattern>
-      </mobile>
-      <tollFree>
-        <nationalNumberPattern>800\d{7}</nationalNumberPattern>
-        <possibleNumberPattern>\d{10}</possibleNumberPattern>
-      </tollFree>
-      <premiumRate>
-        <nationalNumberPattern>900([135]\d{6}|9\d{7})</nationalNumberPattern>
-        <possibleNumberPattern>\d{10,11}</possibleNumberPattern>
-      </premiumRate>
-    </territory>
-
-    <!-- United Kingdom -->
-    <territory id="GB" countryCode="44" internationalPrefix="00"
-               nationalPrefix="0" nationalPrefixFormattingRule="($NP$FG)">
-      <availableFormats>
-        <numberFormat leadingDigits="[1-59]|[78]0"
-                      pattern="(\d{2})(\d{4})(\d{4})">$1 $2 $3</numberFormat>
-        <numberFormat leadingDigits="6"
-                      pattern="(\d)(\d{3})(\d{3})(\d{3})">$1 $2 $3 $4</numberFormat>
-        <numberFormat leadingDigits="7[1-57-9]"
-                      pattern="(\d{4})(\d{3})(\d{3})">$1 $2 $3</numberFormat>
-        <numberFormat leadingDigits="8[47]"
-                      pattern="(\d{3})(\d{3})(\d{4})">$1 $2 $3</numberFormat>
-      </availableFormats>
-      <generalDesc>
-        <nationalNumberPattern>\d{10}</nationalNumberPattern>
-        <possibleNumberPattern>\d{6,10}</possibleNumberPattern>
-      </generalDesc>
-      <fixedLine>
-        <nationalNumberPattern>[1-6]\d{9}</nationalNumberPattern>
-      </fixedLine>
-      <mobile>
-        <nationalNumberPattern>7[1-57-9]\d{8}</nationalNumberPattern>
-        <possibleNumberPattern>\d{10}</possibleNumberPattern>
-      </mobile>
-      <tollFree>
-        <nationalNumberPattern>80\d{8}</nationalNumberPattern>
-        <possibleNumberPattern>\d{10}</possibleNumberPattern>
-      </tollFree>
-      <premiumRate>
-        <nationalNumberPattern>9[018]\d{8}</nationalNumberPattern>
-        <possibleNumberPattern>\d{10}</possibleNumberPattern>
-      </premiumRate>
-      <sharedCost>
-        <nationalNumberPattern>8(?:4[3-5]|7[0-2])\d{7}</nationalNumberPattern>
-        <possibleNumberPattern>\d{10}</possibleNumberPattern>
-      </sharedCost>
-      <voip>
-        <nationalNumberPattern>56\d{8}</nationalNumberPattern>
-        <possibleNumberPattern>\d{10}</possibleNumberPattern>
-      </voip>
-      <personalNumber>
-        <nationalNumberPattern>70\d{8}</nationalNumberPattern>
-        <possibleNumberPattern>\d{10}</possibleNumberPattern>
-      </personalNumber>
-    </territory>
-
-    <!-- Italy -->
-    <!-- http://en.wikipedia.org/wiki/%2B39 -->
-    <territory id="IT" countryCode="39" internationalPrefix="00">
-      <availableFormats>
-        <numberFormat leadingDigits="0[26]" pattern="(\d{2})(\d{4})(\d{4})">$1 $2 $3</numberFormat>
-        <numberFormat leadingDigits="0[13-57-9]" pattern="(\d{3})(\d{4})(\d{3,4})">$1 $2 $3</numberFormat>
-        <numberFormat leadingDigits="3" pattern="(\d{3})(\d{3})(\d{3,4})">$1 $2 $3</numberFormat>
-        <numberFormat leadingDigits="8" pattern="(\d{3})(\d{3,6})">$1 $2</numberFormat>
-      </availableFormats>
-      <generalDesc>
-        <nationalNumberPattern>[0389]\d{5,10}</nationalNumberPattern>
-        <possibleNumberPattern>\d{6,11}</possibleNumberPattern>
-      </generalDesc>
-      <fixedLine>
-        <nationalNumberPattern>0\d{9,10}</nationalNumberPattern>
-        <possibleNumberPattern>\d{10,11}</possibleNumberPattern>
-      </fixedLine>
-      <mobile>
-        <nationalNumberPattern>3\d{8,9}</nationalNumberPattern>
-        <possibleNumberPattern>\d{9,10}</possibleNumberPattern>
-      </mobile>
-      <tollFree>
-        <nationalNumberPattern>80(?:0\d{6}|3\d{3})</nationalNumberPattern>
-        <possibleNumberPattern>\d{6,9}</possibleNumberPattern>
-      </tollFree>
-      <premiumRate>
-        <nationalNumberPattern>89(?:2\d{3}|9\d{6})</nationalNumberPattern>
-        <possibleNumberPattern>\d{6,9}</possibleNumberPattern>
-      </premiumRate>
-    </territory>
-
-    <!-- Mexico -->
-    <territory id="MX" countryCode="52" internationalPrefix="00"
-               nationalPrefix="01" nationalPrefixForParsing="01|04[45](\d{10})"
-               nationalPrefixTransformRule="1$1">
-      <availableFormats>
-        <numberFormat leadingDigits="[89]00" pattern="(\d{3})(\d{3})(\d{4})">$1 $2 $3</numberFormat>
-        <numberFormat leadingDigits="33|55|81" pattern="(\d{2})(\d{4})(\d{4})">$1 $2 $3</numberFormat>
-        <numberFormat leadingDigits="[2467]|3[0-24-9]|5[0-46-9]|8[2-9]|9[1-9]" pattern="(\d{3})(\d{3})(\d{4})">$1 $2 $3</numberFormat>
-        <numberFormat leadingDigits="1(?:33|55|81)" pattern="1(\d{2})(\d{4})(\d{4})">045 $1 $2 $3</numberFormat>
-        <numberFormat leadingDigits="1(?:[124579]|3[0-24-9]|5[0-46-9]|8[02-9])" pattern="1(\d{3})(\d{3})(\d{4})">045 $1 $2 $3</numberFormat>
-        <intlNumberFormat leadingDigits="[89]00" pattern="(\d{3})(\d{3})(\d{4})">$1 $2 $3</intlNumberFormat>
-        <intlNumberFormat leadingDigits="33|55|81" pattern="(\d{2})(\d{4})(\d{4})">$1 $2 $3</intlNumberFormat>
-        <intlNumberFormat leadingDigits="[2467]|3[0-24-9]|5[0-46-9]|8[2-9]|9[1-9]" pattern="(\d{3})(\d{3})(\d{4})">$1 $2 $3</intlNumberFormat>
-        <intlNumberFormat leadingDigits="1(?:33|55|81)" pattern="(1)(\d{2})(\d{4})(\d{4})">$1 $2 $3 $4</intlNumberFormat>
-        <intlNumberFormat leadingDigits="1(?:[124579]|3[0-24-9]|5[0-46-9]|8[02-9])" pattern="(1)(\d{3})(\d{3})(\d{4})">$1 $2 $3 $4</intlNumberFormat>
-      </availableFormats>
-      <generalDesc>
-        <nationalNumberPattern>[1-9]\d{9,10}</nationalNumberPattern>
-        <possibleNumberPattern>\d{7,11}</possibleNumberPattern>
-      </generalDesc>
-      <fixedLine>
-        <nationalNumberPattern>[2-9]\d{9}</nationalNumberPattern>
-        <possibleNumberPattern>\d{7,10}</possibleNumberPattern>
-      </fixedLine>
-      <mobile>
-        <nationalNumberPattern>1\d{10}</nationalNumberPattern>
-        <possibleNumberPattern>\d{11}</possibleNumberPattern>
-      </mobile>
-      <tollFree>
-        <nationalNumberPattern>800\d{7}</nationalNumberPattern>
-        <possibleNumberPattern>\d{10}</possibleNumberPattern>
-      </tollFree>
-      <premiumRate>
-        <nationalNumberPattern>900\d{7}</nationalNumberPattern>
-        <possibleNumberPattern>\d{10}</possibleNumberPattern>
-      </premiumRate>
-    </territory>
-
-    <!-- New Zealand -->
-    <territory id="NZ" countryCode="64" internationalPrefix="00"
-               nationalPrefix="0" nationalPrefixFormattingRule="$NP$FG">
-      <availableFormats>
-        <numberFormat leadingDigits="24|[34679]" pattern="(\d)(\d{3})(\d{4})">$1-$2 $3</numberFormat>
-        <numberFormat leadingDigits="2[179]" pattern="(\d)(\d{3})(\d{3,5})">$1-$2 $3</numberFormat>
-        <numberFormat leadingDigits="[89]" pattern="(\d{3})(\d{3})(\d{3,4})">$1 $2 $3</numberFormat>
-      </availableFormats>
-      <generalDesc>
-        <nationalNumberPattern>[2-9]\d{7,9}</nationalNumberPattern>
-        <possibleNumberPattern>\d{7,10}</possibleNumberPattern>
-      </generalDesc>
-      <fixedLine>
-        <nationalNumberPattern>24099\d{3}|(?:3[2-79]|[479][2-689]|6[235-9])\d{6}</nationalNumberPattern>
-        <possibleNumberPattern>\d{7,8}</possibleNumberPattern>
-      </fixedLine>
-      <mobile>
-        <nationalNumberPattern>2(?:[027]\d{7}|9\d{6,7}|1(?:0\d{5,7}|[12]\d{5,6}|[3-9]\d{5})|4[1-9]\d{6}|8\d{7,8})</nationalNumberPattern>
-        <possibleNumberPattern>\d{8,10}</possibleNumberPattern>
-      </mobile>
-      <tollFree>
-        <nationalNumberPattern>800\d{6,7}</nationalNumberPattern>
-        <possibleNumberPattern>\d{9,10}</possibleNumberPattern>
-      </tollFree>
-      <premiumRate>
-        <nationalNumberPattern>900\d{6,7}</nationalNumberPattern>
-        <possibleNumberPattern>\d{9,10}</possibleNumberPattern>
-      </premiumRate>
-    </territory>
-
-    <!-- Poland -->
-    <!-- http://en.wikipedia.org/wiki/%2B48 -->
-    <territory id="PL" countryCode="48" internationalPrefix="0~0"
-               nationalPrefix="0" nationalPrefixFormattingRule="$NP$FG">
-      <availableFormats>
-        <numberFormat pattern="(\d{2})(\d{3})(\d{2})(\d{2})">$1 $2 $3 $4</numberFormat>
-      </availableFormats>
-      <generalDesc>
-        <nationalNumberPattern>[1-9]\d{8}</nationalNumberPattern>
-        <possibleNumberPattern>\d{9}</possibleNumberPattern>
-      </generalDesc>
-      <mobile>
-        <nationalNumberPattern>(?:5[01]|6[069]|7[289]|88)\d{7}</nationalNumberPattern>
-      </mobile>
-      <tollFree>
-        <nationalNumberPattern>800\d{6}</nationalNumberPattern>
-      </tollFree>
-      <premiumRate>
-        <nationalNumberPattern>70\d{7}</nationalNumberPattern>
-      </premiumRate>
-    </territory>
-
-    <!-- Singapore -->
-    <!-- http://www.ida.gov.sg/policies%20and%20regulation/20060508120124.aspx -->
-    <territory id="SG" countryCode="65" internationalPrefix="0[0-3][0-9]">
-      <availableFormats>
-        <numberFormat leadingDigits="[369]|8[1-9]" pattern="(\d{4})(\d{4})">$1 $2</numberFormat>
-        <numberFormat leadingDigits="1[89]" pattern="(\d{4})(\d{3})(\d{4})">$1 $2 $3</numberFormat>
-        <numberFormat leadingDigits="800" pattern="(\d{3})(\d{3})(\d{4})">$1 $2 $3</numberFormat>
-      </availableFormats>
-      <generalDesc>
-        <nationalNumberPattern>[13689]\d{7,10}</nationalNumberPattern>
-        <possibleNumberPattern>\d{8,11}</possibleNumberPattern>
-      </generalDesc>
-      <fixedLine>
-        <nationalNumberPattern>[36]\d{7}</nationalNumberPattern>
-        <possibleNumberPattern>\d{8}</possibleNumberPattern>
-      </fixedLine>
-      <mobile>
-        <nationalNumberPattern>[89]\d{7}</nationalNumberPattern>
-        <possibleNumberPattern>\d{8}</possibleNumberPattern>
-      </mobile>
-      <tollFree>
-        <nationalNumberPattern>1?800\d{7}</nationalNumberPattern>
-        <possibleNumberPattern>\d{10,11}</possibleNumberPattern>
-      </tollFree>
-      <premiumRate>
-        <nationalNumberPattern>1900\d{7}</nationalNumberPattern>
-        <possibleNumberPattern>\d{11}</possibleNumberPattern>
-      </premiumRate>
-    </territory>
-
-    <!-- United States -->
-    <!-- http://www.nanpa.com/reports/reports_npa.html -->
-    <!-- For testing purposes, numbers starting with 24 are not considered US
-    numbers.-->
-    <territory id="US" countryCode="1" internationalPrefix="011"
-               preferredExtnPrefix=" extn. ">
-      <availableFormats>
-        <numberFormat pattern="(\d{3})(\d{3})(\d{4})">$1 $2 $3</numberFormat>
-        <numberFormat pattern="(\d{3})(\d{4})">$1 $2</numberFormat>
-      </availableFormats>
-      <generalDesc>
-        <nationalNumberPattern>[13-9]\d{9}|2[0-35-9]\d{8}</nationalNumberPattern>
-        <possibleNumberPattern>\d{7,10}</possibleNumberPattern>
-        <exampleNumber>1234567890</exampleNumber>
-      </generalDesc>
-      <tollFree>
-        <nationalNumberPattern>8(00|66|77|88)\d{7}</nationalNumberPattern>
-        <possibleNumberPattern>\d{10}</possibleNumberPattern>
-      </tollFree>
-      <premiumRate>
-        <nationalNumberPattern>900\d{7}</nationalNumberPattern>
-        <possibleNumberPattern>\d{10}</possibleNumberPattern>
-      </premiumRate>
-    </territory>
-  </territories>
-</phoneNumberMetadata>

File java/src/com/google/i18n/phonenumbers/PhoneNumberMetadataProtoForTesting

Binary file removed.

File java/src/com/google/i18n/phonenumbers/PhoneNumberUtilTest.java

-/*
- * Copyright (C) 2009 Google Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.google.i18n.phonenumbers;
-
-import com.google.i18n.phonenumbers.Phonemetadata.NumberFormat;
-import com.google.i18n.phonenumbers.Phonemetadata.PhoneMetadata;
-import com.google.i18n.phonenumbers.Phonenumber.PhoneNumber;
-import com.google.protobuf.MessageLite;
-import junit.framework.TestCase;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Set;
-import java.util.regex.Pattern;
-
-/**
- * Unit tests for PhoneNumberUtil.java
- *
- * Note that these tests use the metadata contained in the file specified by TEST_META_DATA_FILE,
- * not the normal metadata file, so should not be used for regression test purposes - these tests
- * are illustrative only and test functionality.
- *
- * @author Shaopeng Jia
- * @author Lara Rennie
- */
-public class PhoneNumberUtilTest extends TestCase {
-  private PhoneNumberUtil phoneUtil;
-  private static final String TEST_META_DATA_FILE =
-      "/com/google/i18n/phonenumbers/PhoneNumberMetadataProtoForTesting";
-
-  public PhoneNumberUtilTest() {
-    PhoneNumberUtil.resetInstance();
-    InputStream in = PhoneNumberUtilTest.class.getResourceAsStream(TEST_META_DATA_FILE);
-    phoneUtil = PhoneNumberUtil.getInstance(in);
-  }
-
-  @Override
-  protected void setUp() throws Exception {
-    super.setUp();
-  }
-
-  @Override
-  protected void tearDown() throws Exception {
-    super.tearDown();
-  }
-
-  private Boolean assertEquals(MessageLite message1, MessageLite message2) {
-    return PhoneNumberUtil.areSameMessages(message1, message2);
-  }
-
-  public void testGetInstanceLoadUSMetadata() throws IOException {
-    PhoneMetadata metadata = phoneUtil.getPhoneMetadata("US");
-    assertEquals("US", metadata.getId());
-    assertEquals(1, metadata.getCountryCode());
-    assertEquals("011", metadata.getInternationalPrefix());
-    assertFalse(metadata.hasNationalPrefix());
-    assertEquals(2, metadata.getNumberFormatCount());
-    assertEquals("(\\d{3})(\\d{3})(\\d{4})",
-                 metadata.getNumberFormat(0).getPattern());
-    assertEquals("$1 $2 $3", metadata.getNumberFormat(0).getFormat());
-    assertEquals("[13-9]\\d{9}|2[0-35-9]\\d{8}",
-                 metadata.getGeneralDesc().getNationalNumberPattern());
-    assertEquals("\\d{7,10}", metadata.getGeneralDesc().getPossibleNumberPattern());
-    assertEquals(metadata.getGeneralDesc(), metadata.getFixedLine());
-    assertEquals("\\d{10}", metadata.getTollFree().getPossibleNumberPattern());
-    assertEquals("900\\d{7}", metadata.getPremiumRate().getNationalNumberPattern());
-    // No shared-cost data is available, so it should be initialised to "NA".
-    assertEquals("NA", metadata.getSharedCost().getNationalNumberPattern());
-    assertEquals("NA", metadata.getSharedCost().getPossibleNumberPattern());
-  }
-
-  public void testGetInstanceLoadDEMetadata() {
-    PhoneMetadata metadata = phoneUtil.getPhoneMetadata("DE");
-    assertEquals("DE", metadata.getId());
-    assertEquals(49, metadata.getCountryCode());
-    assertEquals("00", metadata.getInternationalPrefix());
-    assertEquals("0", metadata.getNationalPrefix());
-    assertEquals(6, metadata.getNumberFormatCount());
-    assertEquals("9009", metadata.getNumberFormat(5).getLeadingDigits());
-    assertEquals("(\\d{3})(\\d{4})(\\d{4})",
-                 metadata.getNumberFormat(5).getPattern());
-    assertEquals("$1 $2 $3", metadata.getNumberFormat(5).getFormat());
-    assertEquals("(?:[24-6]\\d{2}|3[03-9]\\d|[789](?:[1-9]\\d|0[2-9]))\\d{3,8}",
-                 metadata.getFixedLine().getNationalNumberPattern());
-    assertEquals("\\d{2,14}", metadata.getFixedLine().getPossibleNumberPattern());
-    assertEquals("30123456", metadata.getFixedLine().getExampleNumber());
-    assertEquals("\\d{10}", metadata.getTollFree().getPossibleNumberPattern());
-    assertEquals("900([135]\\d{6}|9\\d{7})", metadata.getPremiumRate().getNationalNumberPattern());
-  }
-
-  public void testGetInstanceLoadARMetadata() {
-    PhoneMetadata metadata = phoneUtil.getPhoneMetadata("AR");
-    assertEquals("AR", metadata.getId());
-    assertEquals(54, metadata.getCountryCode());
-    assertEquals("00", metadata.getInternationalPrefix());
-    assertEquals("0", metadata.getNationalPrefix());
-    assertEquals("0(?:(11|343|3715)15)?", metadata.getNationalPrefixForParsing());
-    assertEquals("9$1", metadata.getNationalPrefixTransformRule());
-    assertEquals("9(\\d{4})(\\d{2})(\\d{4})",
-                 metadata.getNumberFormat(3).getPattern());
-    assertEquals("$1 15 $2-$3", metadata.getNumberFormat(3).getFormat());
-    assertEquals("(9)(\\d{4})(\\d{2})(\\d{4})",
-                 metadata.getIntlNumberFormat(3).getPattern());
-    assertEquals("$1 $2 $3 $4", metadata.getIntlNumberFormat(3).getFormat());
-  }
-
-  public void testGetExampleNumber() throws IOException {
-    PhoneNumber deNumber =
-        PhoneNumber.newBuilder().setCountryCode(49).setNationalNumber(30123456).build();
-    assertEquals(deNumber, phoneUtil.getExampleNumber("DE"));
-
-    assertEquals(deNumber,
-                 phoneUtil.getExampleNumberForType("DE",
-                                                   PhoneNumberUtil.PhoneNumberType.FIXED_LINE));
-    assertEquals(null,
-                 phoneUtil.getExampleNumberForType("DE",
-                                                   PhoneNumberUtil.PhoneNumberType.MOBILE));
-    // For the US, the example number is placed under general description, and hence should be used
-    // for both fixed line and mobile, so neither of these should return null.
-    assertNotNull(phoneUtil.getExampleNumberForType("US",
-                                                    PhoneNumberUtil.PhoneNumberType.FIXED_LINE));
-    assertNotNull(phoneUtil.getExampleNumberForType("US",
-                                                    PhoneNumberUtil.PhoneNumberType.MOBILE));
-  }
-
-  public void testNormaliseRemovePunctuation() {
-    String inputNumber = "034-56&+#234";
-    String expectedOutput = "03456234";
-    assertEquals("Conversion did not correctly remove punctuation",
-                 expectedOutput,
-                 PhoneNumberUtil.normalize(inputNumber));
-  }
-
-  public void testNormaliseReplaceAlphaCharacters() {
-    String inputNumber = "034-I-am-HUNGRY";
-    String expectedOutput = "034426486479";
-    assertEquals("Conversion did not correctly replace alpha characters",
-                 expectedOutput,
-                 PhoneNumberUtil.normalize(inputNumber));
-  }
-
-  public void testNormaliseOtherDigits() {
-    String inputNumber = "\uFF125\u0665";
-    String expectedOutput = "255";
-    assertEquals("Conversion did not correctly replace non-latin digits",
-                 expectedOutput,
-                 PhoneNumberUtil.normalize(inputNumber));
-  }
-
-  public void testNormaliseStripAlphaCharacters() {
-    String inputNumber = "034-56&+a#234";
-    String expectedOutput = "03456234";
-    assertEquals("Conversion did not correctly remove alpha character",
-                 expectedOutput,
-                 PhoneNumberUtil.normalizeDigitsOnly(inputNumber));
-  }
-
-  public void testFormatUSNumber() {
-    PhoneNumber usNumber1 =
-        PhoneNumber.newBuilder().setCountryCode(1).setNationalNumber(6502530000L).build();
-    assertEquals("650 253 0000", phoneUtil.format(usNumber1,
-                                                  PhoneNumberUtil.PhoneNumberFormat.NATIONAL));
-    assertEquals("+1 650 253 0000",
-                 phoneUtil.format(usNumber1,
-                                  PhoneNumberUtil.PhoneNumberFormat.INTERNATIONAL));
-
-    PhoneNumber usNumber2 =
-        PhoneNumber.newBuilder().setCountryCode(1).setNationalNumber(8002530000L).build();
-    assertEquals("800 253 0000", phoneUtil.format(usNumber2,
-                                                  PhoneNumberUtil.PhoneNumberFormat.NATIONAL));
-    assertEquals("+1 800 253 0000",
-                 phoneUtil.format(usNumber2,
-                                  PhoneNumberUtil.PhoneNumberFormat.INTERNATIONAL));
-
-    PhoneNumber usNumber3 =
-        PhoneNumber.newBuilder().setCountryCode(1).setNationalNumber(9002530000L).build();
-    assertEquals("900 253 0000", phoneUtil.format(usNumber3,
-                                                  PhoneNumberUtil.PhoneNumberFormat.NATIONAL));
-    assertEquals("+1 900 253 0000",
-                 phoneUtil.format(usNumber3,
-                                  PhoneNumberUtil.PhoneNumberFormat.INTERNATIONAL));
-  }
-
-  public void testFormatBSNumber() {
-    PhoneNumber bsNumber1 =
-        PhoneNumber.newBuilder().setCountryCode(1).setNationalNumber(2421234567L).build();
-    assertEquals("242 123 4567", phoneUtil.format(bsNumber1,
-                                                  PhoneNumberUtil.PhoneNumberFormat.NATIONAL));
-    assertEquals("+1 242 123 4567",
-                 phoneUtil.format(bsNumber1,
-                                  PhoneNumberUtil.PhoneNumberFormat.INTERNATIONAL));
-
-    PhoneNumber bsNumber2 =
-        PhoneNumber.newBuilder().setCountryCode(1).setNationalNumber(8002530000L).build();
-    assertEquals("800 253 0000", phoneUtil.format(bsNumber2,
-                                                  PhoneNumberUtil.PhoneNumberFormat.NATIONAL));
-    assertEquals("+1 800 253 0000",
-                 phoneUtil.format(bsNumber2,
-                                  PhoneNumberUtil.PhoneNumberFormat.INTERNATIONAL));
-
-    PhoneNumber bsNumber3 =
-        PhoneNumber.newBuilder().setCountryCode(1).setNationalNumber(9002530000L).build();
-    assertEquals("900 253 0000", phoneUtil.format(bsNumber3,
-                                                  PhoneNumberUtil.PhoneNumberFormat.NATIONAL));
-    assertEquals("+1 900 253 0000",
-                 phoneUtil.format(bsNumber3,
-                                  PhoneNumberUtil.PhoneNumberFormat.INTERNATIONAL));
-  }
-
-  public void testFormatGBNumber() {
-    PhoneNumber gbNumber1 =
-        PhoneNumber.newBuilder().setCountryCode(44).setNationalNumber(2087389353L).build();
-    assertEquals("(020) 8738 9353", phoneUtil.format(gbNumber1,
-                                                     PhoneNumberUtil.PhoneNumberFormat.NATIONAL));
-    assertEquals("+44 20 8738 9353",
-                 phoneUtil.format(gbNumber1,
-                                  PhoneNumberUtil.PhoneNumberFormat.INTERNATIONAL));
-
-    PhoneNumber gbNumber2 =
-        PhoneNumber.newBuilder().setCountryCode(44).setNationalNumber(7912345678L).build();
-    assertEquals("(07912) 345 678", phoneUtil.format(gbNumber2,
-                                                     PhoneNumberUtil.PhoneNumberFormat.NATIONAL));
-    assertEquals("+44 7912 345 678",
-                 phoneUtil.format(gbNumber2,
-                                  PhoneNumberUtil.PhoneNumberFormat.INTERNATIONAL));
-  }
-
-  public void testFormatDENumber() {
-    PhoneNumber deNumber1 =
-        PhoneNumber.newBuilder().setCountryCode(49).setNationalNumber(301234L).build();
-    assertEquals("030 1234", phoneUtil.format(deNumber1,
-                                              PhoneNumberUtil.PhoneNumberFormat.NATIONAL));
-    assertEquals("+49 30 1234",
-                 phoneUtil.format(deNumber1,
-                                  PhoneNumberUtil.PhoneNumberFormat.INTERNATIONAL));
-
-    PhoneNumber deNumber2 =
-        PhoneNumber.newBuilder().setCountryCode(49).setNationalNumber(291123L).build();
-    assertEquals("0291 123", phoneUtil.format(deNumber2,
-                                              PhoneNumberUtil.PhoneNumberFormat.NATIONAL));
-    assertEquals("+49 291 123",
-                 phoneUtil.format(deNumber2,
-                                  PhoneNumberUtil.PhoneNumberFormat.INTERNATIONAL));
-
-    PhoneNumber deNumber3 =
-        PhoneNumber.newBuilder().setCountryCode(49).setNationalNumber(29112345678L).build();
-    assertEquals("0291 12345678", phoneUtil.format(deNumber3,
-                                                   PhoneNumberUtil.PhoneNumberFormat.NATIONAL));
-    assertEquals("+49 291 12345678",
-                 phoneUtil.format(deNumber3,
-                                  PhoneNumberUtil.PhoneNumberFormat.INTERNATIONAL));
-
-    PhoneNumber deNumber4 =
-        PhoneNumber.newBuilder().setCountryCode(49).setNationalNumber(9123123L).build();
-    assertEquals("09123 123", phoneUtil.format(deNumber4,
-                                               PhoneNumberUtil.PhoneNumberFormat.NATIONAL));
-    assertEquals("+49 9123 123",
-                 phoneUtil.format(deNumber4,
-                                  PhoneNumberUtil.PhoneNumberFormat.INTERNATIONAL));
-    PhoneNumber deNumber5 =
-        PhoneNumber.newBuilder().setCountryCode(49).setNationalNumber(1234L).build();
-    // Note this number is correctly formatted without national prefix. Most of the numbers that
-    // are treated as invalid numbers by the library are short numbers, and they are usually not
-    // dialed with national prefix.
-    assertEquals("1234", phoneUtil.format(deNumber5,
-                                          PhoneNumberUtil.PhoneNumberFormat.NATIONAL));
-    assertEquals("+49 1234",
-                 phoneUtil.format(deNumber5,
-                                  PhoneNumberUtil.PhoneNumberFormat.INTERNATIONAL));
-  }
-
-  public void testFormatITNumber() {
-    PhoneNumber itNumber1 =
-        PhoneNumber.newBuilder()
-            .setCountryCode(39).setNationalNumber(236618300L).setItalianLeadingZero(true).build();
-    assertEquals("02 3661 8300", phoneUtil.format(itNumber1,
-                                                  PhoneNumberUtil.PhoneNumberFormat.NATIONAL));
-    assertEquals("+39 02 3661 8300",
-                 phoneUtil.format(itNumber1,
-                                  PhoneNumberUtil.PhoneNumberFormat.INTERNATIONAL));
-    assertEquals("+390236618300",
-                 phoneUtil.format(itNumber1,
-                                  PhoneNumberUtil.PhoneNumberFormat.E164));
-
-    PhoneNumber itNumber2 =
-        PhoneNumber.newBuilder().setCountryCode(39).setNationalNumber(345678901L).build();
-    assertEquals("345 678 901", phoneUtil.format(itNumber2,
-                                                 PhoneNumberUtil.PhoneNumberFormat.NATIONAL));
-    assertEquals("+39 345 678 901",
-                 phoneUtil.format(itNumber2,
-                                  PhoneNumberUtil.PhoneNumberFormat.INTERNATIONAL));
-    assertEquals("+39345678901",
-                 phoneUtil.format(itNumber2,
-                                  PhoneNumberUtil.PhoneNumberFormat.E164));
-  }
-
-  public void testFormatAUNumber() {
-    PhoneNumber auNumber1 =
-        PhoneNumber.newBuilder().setCountryCode(61).setNationalNumber(236618300L).build();
-    assertEquals("02 3661 8300", phoneUtil.format(auNumber1,
-                                                  PhoneNumberUtil.PhoneNumberFormat.NATIONAL));
-    assertEquals("+61 2 3661 8300",
-                 phoneUtil.format(auNumber1,
-                                  PhoneNumberUtil.PhoneNumberFormat.INTERNATIONAL));
-    assertEquals("+61236618300",
-                 phoneUtil.format(auNumber1,
-                                  PhoneNumberUtil.PhoneNumberFormat.E164));
-
-    PhoneNumber auNumber2 =
-        PhoneNumber.newBuilder().setCountryCode(61).setNationalNumber(1800123456L).build();
-    assertEquals("1800 123 456", phoneUtil.format(auNumber2,
-                                                 PhoneNumberUtil.PhoneNumberFormat.NATIONAL));
-    assertEquals("+61 1800 123 456",
-                 phoneUtil.format(auNumber2,
-                                  PhoneNumberUtil.PhoneNumberFormat.INTERNATIONAL));
-    assertEquals("+611800123456",
-                 phoneUtil.format(auNumber2,
-                                  PhoneNumberUtil.PhoneNumberFormat.E164));
-  }
-
-  public void testFormatARNumber() {
-    PhoneNumber arNumber1 =
-        PhoneNumber.newBuilder().setCountryCode(54).setNationalNumber(1187654321L).build();
-    assertEquals("011 8765-4321", phoneUtil.format(arNumber1,
-                                                  PhoneNumberUtil.PhoneNumberFormat.NATIONAL));
-    assertEquals("+54 11 8765-4321",
-                 phoneUtil.format(arNumber1,
-                                  PhoneNumberUtil.PhoneNumberFormat.INTERNATIONAL));
-    assertEquals("+541187654321",
-                 phoneUtil.format(arNumber1,
-                                  PhoneNumberUtil.PhoneNumberFormat.E164));
-
-    PhoneNumber arNumber2 =
-        PhoneNumber.newBuilder().setCountryCode(54).setNationalNumber(91187654321L).build();
-    assertEquals("011 15 8765-4321", phoneUtil.format(arNumber2,
-                                                      PhoneNumberUtil.PhoneNumberFormat.NATIONAL));
-    assertEquals("+54 9 11 8765 4321",
-                 phoneUtil.format(arNumber2,
-                                  PhoneNumberUtil.PhoneNumberFormat.INTERNATIONAL));
-    assertEquals("+5491187654321",
-                 phoneUtil.format(arNumber2,
-                                  PhoneNumberUtil.PhoneNumberFormat.E164));
-  }
-
-  public void testFormatOutOfCountryCallingNumber() {
-    PhoneNumber usNumber1 =
-        PhoneNumber.newBuilder().setCountryCode(1).setNationalNumber(9002530000L).build();
-    assertEquals("00 1 900 253 0000",
-                 phoneUtil.formatOutOfCountryCallingNumber(usNumber1, "DE"));
-
-    PhoneNumber usNumber2 =
-        PhoneNumber.newBuilder().setCountryCode(1).setNationalNumber(6502530000L).build();
-    assertEquals("1 650 253 0000",
-                 phoneUtil.formatOutOfCountryCallingNumber(usNumber2, "BS"));
-
-    assertEquals("0~0 1 650 253 0000",
-                 phoneUtil.formatOutOfCountryCallingNumber(usNumber2, "PL"));
-
-    PhoneNumber gbNumber =
-        PhoneNumber.newBuilder().setCountryCode(44).setNationalNumber(7912345678L).build();
-    assertEquals("011 44 7912 345 678",
-                 phoneUtil.formatOutOfCountryCallingNumber(gbNumber, "US"));
-
-    PhoneNumber deNumber =
-        PhoneNumber.newBuilder().setCountryCode(49).setNationalNumber(1234L).build();
-    assertEquals("00 49 1234",
-                 phoneUtil.formatOutOfCountryCallingNumber(deNumber, "GB"));
-    // Note this number is correctly formatted without national prefix. Most of the numbers that
-    // are treated as invalid numbers by the library are short numbers, and they are usually not
-    // dialed with national prefix.
-    assertEquals("1234",
-                 phoneUtil.formatOutOfCountryCallingNumber(deNumber, "DE"));
-
-    PhoneNumber itNumber =
-        PhoneNumber.newBuilder().setCountryCode(39).setNationalNumber(236618300L)
-            .setItalianLeadingZero(true).build();
-    assertEquals("011 39 02 3661 8300",
-                 phoneUtil.formatOutOfCountryCallingNumber(itNumber, "US"));
-    assertEquals("02 3661 8300",
-                 phoneUtil.formatOutOfCountryCallingNumber(itNumber, "IT"));
-    assertEquals("+39 02 3661 8300",
-                 phoneUtil.formatOutOfCountryCallingNumber(itNumber, "SG"));
-
-    PhoneNumber sgNumber =
-        PhoneNumber.newBuilder().setCountryCode(65).setNationalNumber(94777892L).build();
-    assertEquals("9477 7892",
-                 phoneUtil.formatOutOfCountryCallingNumber(sgNumber, "SG"));
-
-    PhoneNumber arNumber1 =
-        PhoneNumber.newBuilder().setCountryCode(54).setNationalNumber(91187654321L).build();
-    assertEquals("011 54 9 11 8765 4321",
-                 phoneUtil.formatOutOfCountryCallingNumber(arNumber1, "US"));
-
-    PhoneNumber arNumber2 =
-        PhoneNumber.newBuilder().setCountryCode(54).setNationalNumber(91187654321L)
-            .setExtension("1234").build();
-    assertEquals("011 54 9 11 8765 4321 ext. 1234",
-                 phoneUtil.formatOutOfCountryCallingNumber(arNumber2, "US"));
-    assertEquals("0011 54 9 11 8765 4321 ext. 1234",
-                 phoneUtil.formatOutOfCountryCallingNumber(arNumber2, "AU"));
-    assertEquals("011 15 8765-4321 ext. 1234",
-                 phoneUtil.formatOutOfCountryCallingNumber(arNumber2, "AR"));
-  }
-
-  public void testFormatOutOfCountryWithPreferredIntlPrefix() {
-    PhoneNumber.Builder itNumber = PhoneNumber.newBuilder();
-    itNumber.setCountryCode(39).setNationalNumber(236618300L).setItalianLeadingZero(true);
-    // This should use 0011, since that is the preferred international prefix (both 0011 and 0012
-    // are accepted as possible international prefixes in our test metadta.)
-    assertEquals("0011 39 02 3661 8300",
-                 phoneUtil.formatOutOfCountryCallingNumber(itNumber.build(), "AU"));
-  }
-
-  public void testFormatByPattern() {
-    PhoneNumber usNumber =
-        PhoneNumber.newBuilder().setCountryCode(1).setNationalNumber(6502530000L).build();
-    NumberFormat newNumFormat1 =
-        NumberFormat.newBuilder().setPattern("(\\d{3})(\\d{3})(\\d{4})")
-            .setFormat("($1) $2-$3").build();
-    List<NumberFormat> newNumberFormats = new ArrayList<NumberFormat>();
-    newNumberFormats.add(newNumFormat1);
-
-    assertEquals("(650) 253-0000",
-                 phoneUtil.formatByPattern(usNumber,
-                                           PhoneNumberUtil.PhoneNumberFormat.NATIONAL,
-                                           newNumberFormats));
-    assertEquals("+1 (650) 253-0000",
-                 phoneUtil.formatByPattern(usNumber,
-                                           PhoneNumberUtil.PhoneNumberFormat.INTERNATIONAL,
-                                           newNumberFormats));
-
-    PhoneNumber itNumber =
-        PhoneNumber.newBuilder().setCountryCode(39).setNationalNumber(236618300L)
-            .setItalianLeadingZero(true).build();
-    NumberFormat newNumFormat2 =
-        NumberFormat.newBuilder().setPattern("(\\d{2})(\\d{5})(\\d{3})")
-            .setFormat("$1-$2 $3").build();
-    newNumberFormats.set(0, newNumFormat2);
-
-    assertEquals("02-36618 300",
-                 phoneUtil.formatByPattern(itNumber,
-                                           PhoneNumberUtil.PhoneNumberFormat.NATIONAL,
-                                           newNumberFormats));
-    assertEquals("+39 02-36618 300",
-                 phoneUtil.formatByPattern(itNumber,
-                                           PhoneNumberUtil.PhoneNumberFormat.INTERNATIONAL,
-                                           newNumberFormats));
-
-    PhoneNumber gbNumber =
-        PhoneNumber.newBuilder().setCountryCode(44).setNationalNumber(2012345678L).build();
-
-    NumberFormat newNumFormat3 =
-        NumberFormat.newBuilder().setNationalPrefixFormattingRule("$NP$FG")
-            .setPattern("(\\d{2})(\\d{4})(\\d{4})").setFormat("$1 $2 $3").build();
-    newNumberFormats.set(0, newNumFormat3);
-    assertEquals("020 1234 5678",
-                 phoneUtil.formatByPattern(gbNumber,
-                                           PhoneNumberUtil.PhoneNumberFormat.NATIONAL,
-                                           newNumberFormats));
-
-    NumberFormat newNumFormat4 =
-        NumberFormat.newBuilder(newNumFormat3).setNationalPrefixFormattingRule("($NP$FG)").build();
-    newNumberFormats.set(0, newNumFormat4);
-    assertEquals("(020) 1234 5678",
-                 phoneUtil.formatByPattern(gbNumber,
-                                           PhoneNumberUtil.PhoneNumberFormat.NATIONAL,
-                                           newNumberFormats));
-    NumberFormat newNumFormat5 =
-        NumberFormat.newBuilder(newNumFormat4).setNationalPrefixFormattingRule("").build();
-    newNumberFormats.set(0, newNumFormat5);
-    assertEquals("20 1234 5678",
-                 phoneUtil.formatByPattern(gbNumber,
-                                           PhoneNumberUtil.PhoneNumberFormat.NATIONAL,
-                                           newNumberFormats));
-
-    NumberFormat newNumFormat6 =
-        NumberFormat.newBuilder(newNumFormat5).setNationalPrefixFormattingRule("").build();
-    newNumberFormats.set(0, newNumFormat6);
-    assertEquals("+44 20 1234 5678",
-                 phoneUtil.formatByPattern(gbNumber,
-                                           PhoneNumberUtil.PhoneNumberFormat.INTERNATIONAL,
-                                           newNumberFormats));
-  }
-
-  public void testFormatE164Number() {
-    PhoneNumber.Builder usNumber = PhoneNumber.newBuilder();
-    usNumber.setCountryCode(1).setNationalNumber(6502530000L);
-    assertEquals("+16502530000", phoneUtil.format(usNumber.build(),
-                                                  PhoneNumberUtil.PhoneNumberFormat.E164));
-    PhoneNumber.Builder deNumber = PhoneNumber.newBuilder();
-    deNumber.setCountryCode(49).setNationalNumber(301234L);
-    assertEquals("+49301234", phoneUtil.format(deNumber.build(),
-                                               PhoneNumberUtil.PhoneNumberFormat.E164));
-  }
-
-  public void testFormatNumberWithExtension() {
-    PhoneNumber.Builder nzNumber = PhoneNumber.newBuilder();
-    nzNumber.setCountryCode(64).setNationalNumber(33316005L).setExtension("1234");
-    // Uses default extension prefix:
-    assertEquals("03-331 6005 ext. 1234",
-                 phoneUtil.format(nzNumber.build(),
-                                  PhoneNumberUtil.PhoneNumberFormat.NATIONAL));
-    // Extension prefix overridden in the territory information for the US:
-    PhoneNumber.Builder usNumber = PhoneNumber.newBuilder();
-    usNumber.setCountryCode(1).setNationalNumber(6502530000L).setExtension("4567");
-    assertEquals("650 253 0000 extn. 4567",
-                 phoneUtil.format(usNumber.build(),
-                                  PhoneNumberUtil.PhoneNumberFormat.NATIONAL));
-  }
-
-  public void testIsPremiumRate() {
-    PhoneNumber premiumRateNumber1 =
-        PhoneNumber.newBuilder().setCountryCode(1).setNationalNumber(9004433030L).build();
-    assertEquals(PhoneNumberUtil.PhoneNumberType.PREMIUM_RATE,
-                 phoneUtil.getNumberType(premiumRateNumber1));
-
-    PhoneNumber premiumRateNumber2 =
-        PhoneNumber.newBuilder().setCountryCode(39).setNationalNumber(892123L).build();
-        assertEquals(PhoneNumberUtil.PhoneNumberType.PREMIUM_RATE,
-                 phoneUtil.getNumberType(premiumRateNumber2));
-
-    PhoneNumber premiumRateNumber3 =
-        PhoneNumber.newBuilder().setCountryCode(44).setNationalNumber(9187654321L).build();
-        assertEquals(PhoneNumberUtil.PhoneNumberType.PREMIUM_RATE,
-                 phoneUtil.getNumberType(premiumRateNumber3));
-
-    PhoneNumber premiumRateNumber4 =
-        PhoneNumber.newBuilder().setCountryCode(49).setNationalNumber(9001654321L).build();
-    assertEquals(PhoneNumberUtil.PhoneNumberType.PREMIUM_RATE,
-                 phoneUtil.getNumberType(premiumRateNumber4));
-
-    PhoneNumber premiumRateNumber5 =
-        PhoneNumber.newBuilder().setCountryCode(49).setNationalNumber(90091234567L).build();
-    assertEquals(PhoneNumberUtil.PhoneNumberType.PREMIUM_RATE,
-                 phoneUtil.getNumberType(premiumRateNumber5));
-  }
-
-  public void testIsTollFree() {
-    PhoneNumber tollFreeNumber1
-        = PhoneNumber.newBuilder().setCountryCode(1).setNationalNumber(8881234567L).build();
-    assertEquals(PhoneNumberUtil.PhoneNumberType.TOLL_FREE,
-                 phoneUtil.getNumberType(tollFreeNumber1));
-
-    PhoneNumber tollFreeNumber2
-        = PhoneNumber.newBuilder().setCountryCode(39).setNationalNumber(803123L).build();
-    assertEquals(PhoneNumberUtil.PhoneNumberType.TOLL_FREE,
-                 phoneUtil.getNumberType(tollFreeNumber2));
-
-    PhoneNumber tollFreeNumber3
-        = PhoneNumber.newBuilder().setCountryCode(44).setNationalNumber(8012345678L).build();
-    assertEquals(PhoneNumberUtil.PhoneNumberType.TOLL_FREE,
-                 phoneUtil.getNumberType(tollFreeNumber3));
-
-    PhoneNumber tollFreeNumber4
-        = PhoneNumber.newBuilder().setCountryCode(49).setNationalNumber(8001234567L).build();
-    assertEquals(PhoneNumberUtil.PhoneNumberType.TOLL_FREE,
-                 phoneUtil.getNumberType(tollFreeNumber4));
-  }
-
-  public void testIsMobile() {
-    PhoneNumber mobileNumber1 =
-        PhoneNumber.newBuilder().setCountryCode(1).setNationalNumber(2423570000L).build();
-    assertEquals(PhoneNumberUtil.PhoneNumberType.MOBILE,
-                 phoneUtil.getNumberType(mobileNumber1));
-
-    PhoneNumber mobileNumber2 =
-        PhoneNumber.newBuilder().setCountryCode(39).setNationalNumber(312345678L).build();
-    assertEquals(PhoneNumberUtil.PhoneNumberType.MOBILE,
-                 phoneUtil.getNumberType(mobileNumber2));
-
-    PhoneNumber mobileNumber3 =
-        PhoneNumber.newBuilder().setCountryCode(44).setNationalNumber(7912345678L).build();
-    assertEquals(PhoneNumberUtil.PhoneNumberType.MOBILE,
-                 phoneUtil.getNumberType(mobileNumber3));
-
-    PhoneNumber mobileNumber4 =
-        PhoneNumber.newBuilder().setCountryCode(49).setNationalNumber(15123456789L).build();
-    assertEquals(PhoneNumberUtil.PhoneNumberType.MOBILE,
-                 phoneUtil.getNumberType(mobileNumber4));
-
-    PhoneNumber mobileNumber5 =
-        PhoneNumber.newBuilder().setCountryCode(54).setNationalNumber(91187654321L).build();
-    assertEquals(PhoneNumberUtil.PhoneNumberType.MOBILE,
-                 phoneUtil.getNumberType(mobileNumber5));
-  }
-
-  public void testIsFixedLine() {
-    // A Bahama fixed-line number
-    PhoneNumber fixedLineNumber1 =
-        PhoneNumber.newBuilder().setCountryCode(1).setNationalNumber(2423651234L).build();
-    assertEquals(PhoneNumberUtil.PhoneNumberType.FIXED_LINE,
-                 phoneUtil.getNumberType(fixedLineNumber1));
-
-    // An Italian fixed-line number
-    PhoneNumber fixedLineNumber2 =
-        PhoneNumber.newBuilder().setCountryCode(39).setNationalNumber(236618300L)
-            .setItalianLeadingZero(true).build();
-    assertEquals(PhoneNumberUtil.PhoneNumberType.FIXED_LINE,
-                 phoneUtil.getNumberType(fixedLineNumber2));
-
-    PhoneNumber fixedLineNumber3 =
-        PhoneNumber.newBuilder().setCountryCode(44).setNationalNumber(2012345678L).build();
-    assertEquals(PhoneNumberUtil.PhoneNumberType.FIXED_LINE,
-                 phoneUtil.getNumberType(fixedLineNumber3));
-
-    PhoneNumber fixedLineNumber4 =
-        PhoneNumber.newBuilder().setCountryCode(49).setNationalNumber(301234L).build();
-    assertEquals(PhoneNumberUtil.PhoneNumberType.FIXED_LINE,
-                 phoneUtil.getNumberType(fixedLineNumber4));
-  }
-
-  public void testIsFixedLineAndMobile() {
-    PhoneNumber fixedLineAndMobileNumber1 =
-        PhoneNumber.newBuilder().setCountryCode(1).setNationalNumber(6502531111L).build();
-    assertEquals(PhoneNumberUtil.PhoneNumberType.FIXED_LINE_OR_MOBILE,
-                 phoneUtil.getNumberType(fixedLineAndMobileNumber1));
-
-    PhoneNumber fixedLineAndMobileNumber2 =
-        PhoneNumber.newBuilder().setCountryCode(54).setNationalNumber(1987654321L).build();
-    assertEquals(PhoneNumberUtil.PhoneNumberType.FIXED_LINE_OR_MOBILE,
-                 phoneUtil.getNumberType(fixedLineAndMobileNumber2));
-  }
-
-  public void testIsSharedCost() {
-    PhoneNumber.Builder gbNumber = PhoneNumber.newBuilder();
-    gbNumber.setCountryCode(44).setNationalNumber(8431231234L);
-    assertEquals(PhoneNumberUtil.PhoneNumberType.SHARED_COST,
-        phoneUtil.getNumberType(gbNumber.build()));
-  }
-
-  public void testIsVoip() {
-    PhoneNumber.Builder gbNumber = PhoneNumber.newBuilder();
-    gbNumber.setCountryCode(44).setNationalNumber(5631231234L);
-    assertEquals(PhoneNumberUtil.PhoneNumberType.VOIP, phoneUtil.getNumberType(gbNumber.build()));
-  }
-
-  public void testIsPersonalNumber() {
-    PhoneNumber.Builder gbNumber = PhoneNumber.newBuilder();
-    gbNumber.setCountryCode(44).setNationalNumber(7031231234L);
-    assertEquals(PhoneNumberUtil.PhoneNumberType.PERSONAL_NUMBER,
-                 phoneUtil.getNumberType(gbNumber.build()));
-  }
-
-  public void testIsUnknown() {
-    PhoneNumber.Builder unknownNumber = PhoneNumber.newBuilder();
-    unknownNumber.setCountryCode(1).setNationalNumber(65025311111L);
-    assertEquals(PhoneNumberUtil.PhoneNumberType.UNKNOWN,
-                 phoneUtil.getNumberType(unknownNumber.build()));
-  }
-
-  public void testIsValidNumber() {
-    PhoneNumber.Builder usNumber = PhoneNumber.newBuilder();
-    usNumber.setCountryCode(1).setNationalNumber(6502530000L);
-    assertTrue(phoneUtil.isValidNumber(usNumber.build()));
-
-    PhoneNumber.Builder itNumber = PhoneNumber.newBuilder();
-    itNumber.setCountryCode(39).setNationalNumber(236618300L).setItalianLeadingZero(true);
-    assertTrue(phoneUtil.isValidNumber(itNumber.build()));
-
-    PhoneNumber.Builder gbNumber = PhoneNumber.newBuilder();
-    gbNumber.setCountryCode(44).setNationalNumber(7912345678L);
-    assertTrue(phoneUtil.isValidNumber(gbNumber.build()));
-
-    PhoneNumber.Builder nzNumber = PhoneNumber.newBuilder();
-    nzNumber.setCountryCode(64).setNationalNumber(21387835L);
-    assertTrue(phoneUtil.isValidNumber(nzNumber.build()));
-  }
-
-  public void testIsValidForRegion() {
-    // This number is valid for the Bahamas, but is not a valid US number.
-    PhoneNumber bsNumber1 =
-        PhoneNumber.newBuilder().setCountryCode(1).setNationalNumber(2423232345L).build();
-    assertTrue(phoneUtil.isValidNumber(bsNumber1));
-    assertTrue(phoneUtil.isValidNumberForRegion(bsNumber1, "BS"));
-    assertFalse(phoneUtil.isValidNumberForRegion(bsNumber1, "US"));
-    PhoneNumber bsNumber2 =
-        PhoneNumber.newBuilder(bsNumber1).setNationalNumber(2421232345L).build();
-    // This number is no longer valid.
-    assertFalse(phoneUtil.isValidNumber(bsNumber2));
-  }
-
-  public void testIsNotValidNumber() {
-    PhoneNumber.Builder usNumber = PhoneNumber.newBuilder();
-    usNumber.setCountryCode(1).setNationalNumber(2530000L);
-    assertFalse(phoneUtil.isValidNumber(usNumber.build()));
-
-    PhoneNumber.Builder itNumber = PhoneNumber.newBuilder();
-    itNumber.setCountryCode(39).setNationalNumber(23661830000L).setItalianLeadingZero(true);
-    assertFalse(phoneUtil.isValidNumber(itNumber.build()));
-
-    PhoneNumber.Builder gbNumber = PhoneNumber.newBuilder();
-    gbNumber.setCountryCode(44).setNationalNumber(791234567L);
-    assertFalse(phoneUtil.isValidNumber(gbNumber.build()));
-
-    PhoneNumber.Builder deNumber = PhoneNumber.newBuilder();
-    deNumber.setCountryCode(49).setNationalNumber(1234L);
-    assertFalse(phoneUtil.isValidNumber(deNumber.build()));
-
-    PhoneNumber.Builder nzNumber = PhoneNumber.newBuilder();
-    nzNumber.setCountryCode(64).setNationalNumber(3316005L);
-    assertFalse(phoneUtil.isValidNumber(nzNumber.build()));
-  }
-
-  public void testGetRegionCodeForCountryCode() {
-    assertEquals("US", phoneUtil.getRegionCodeForCountryCode(1));
-    assertEquals("GB", phoneUtil.getRegionCodeForCountryCode(44));
-    assertEquals("DE", phoneUtil.getRegionCodeForCountryCode(49));
-  }
-
-  public void testGetRegionCodeForNumber() {
-    PhoneNumber.Builder bsNumber = PhoneNumber.newBuilder();
-    bsNumber.setCountryCode(1).setNationalNumber(2423027000L);
-    assertEquals("BS", phoneUtil.getRegionCodeForNumber(bsNumber.build()));
-
-    PhoneNumber.Builder usNumber = PhoneNumber.newBuilder();
-    usNumber.setCountryCode(1).setNationalNumber(6502530000L);
-    assertEquals("US", phoneUtil.getRegionCodeForNumber(usNumber.build()));
-
-    PhoneNumber.Builder gbNumber = PhoneNumber.newBuilder();
-    gbNumber.setCountryCode(44).setNationalNumber(7912345678L);
-    assertEquals("GB", phoneUtil.getRegionCodeForNumber(gbNumber.build()));
-  }
-
-  public void testGetCountryCodeForRegion() {
-    assertEquals(1, phoneUtil.getCountryCodeForRegion("US"));
-    assertEquals(64, phoneUtil.getCountryCodeForRegion("NZ"));
-  }
-
-  public void testGetNANPACountries() {
-    Set nanpaCountries = phoneUtil.getNANPACountries();
-    assertEquals(2, nanpaCountries.size());
-    assertTrue(nanpaCountries.contains("US"));
-    assertTrue(nanpaCountries.contains("BS"));
-  }
-
-  public void testIsPossibleNumber() {
-    PhoneNumber number1 =
-        PhoneNumber.newBuilder().setCountryCode(1).setNationalNumber(6502530000L).build();
-    assertTrue(phoneUtil.isPossibleNumber(number1));
-
-    PhoneNumber number2 =
-        PhoneNumber.newBuilder().setCountryCode(1).setNationalNumber(2530000L).build();
-    assertTrue(phoneUtil.isPossibleNumber(number2));
-
-    PhoneNumber number3 =
-        PhoneNumber.newBuilder().setCountryCode(44).setNationalNumber(2070313000L).build();
-    assertTrue(phoneUtil.isPossibleNumber(number3));
-       
-    assertTrue(phoneUtil.isPossibleNumber("+1 650 253 0000", "US"));
-    assertTrue(phoneUtil.isPossibleNumber("+1 650 GOO OGLE", "US"));
-    assertTrue(phoneUtil.isPossibleNumber("(650) 253-0000", "US"));
-    assertTrue(phoneUtil.isPossibleNumber("253-0000", "US"));
-    assertTrue(phoneUtil.isPossibleNumber("+1 650 253 0000", "GB"));
-    assertTrue(phoneUtil.isPossibleNumber("+44 20 7031 3000", "GB"));
-    assertTrue(phoneUtil.isPossibleNumber("(020) 7031 3000", "GB"));
-    assertTrue(phoneUtil.isPossibleNumber("7031 3000", "GB"));
-    assertTrue(phoneUtil.isPossibleNumber("3331 6005", "NZ"));
-  }
-
-
-  public void testIsPossibleNumberWithReason() {
-    // FYI, national numbers for country code +1 that are within 7 to 10 digits are possible.
-    PhoneNumber number1 =
-        PhoneNumber.newBuilder().setCountryCode(1).setNationalNumber(6502530000L).build();
-    assertEquals(PhoneNumberUtil.ValidationResult.IS_POSSIBLE,
-                 phoneUtil.isPossibleNumberWithReason(number1));
-
-    PhoneNumber number2 =
-        PhoneNumber.newBuilder().setCountryCode(1).setNationalNumber(2530000L).build();
-    assertEquals(PhoneNumberUtil.ValidationResult.IS_POSSIBLE,
-                 phoneUtil.isPossibleNumberWithReason(number2));
-
-    PhoneNumber number3 =
-        PhoneNumber.newBuilder().setCountryCode(0).setNationalNumber(2530000L).build();
-    assertEquals(PhoneNumberUtil.ValidationResult.INVALID_COUNTRY_CODE,
-                 phoneUtil.isPossibleNumberWithReason(number3));
-
-    PhoneNumber number4 =
-        PhoneNumber.newBuilder().setCountryCode(1).setNationalNumber(253000L).build();
-    assertEquals(PhoneNumberUtil.ValidationResult.TOO_SHORT,
-                 phoneUtil.isPossibleNumberWithReason(number4));
-
-    PhoneNumber number5 =
-        PhoneNumber.newBuilder().setCountryCode(1).setNationalNumber(65025300000L).build();
-    assertEquals(PhoneNumberUtil.ValidationResult.TOO_LONG,
-                 phoneUtil.isPossibleNumberWithReason(number5));
-  }
-
-  public void testIsNotPossibleNumber() {
-    PhoneNumber number1 =
-        PhoneNumber.newBuilder().setCountryCode(1).setNationalNumber(65025300000L).build();
-    assertFalse(phoneUtil.isPossibleNumber(number1));
-
-    PhoneNumber number2 =
-        PhoneNumber.newBuilder().setCountryCode(1).setNationalNumber(253000L).build();
-    assertFalse(phoneUtil.isPossibleNumber(number2));
-
-    PhoneNumber number3 =
-        PhoneNumber.newBuilder().setCountryCode(44).setNationalNumber(300L).build();
-    assertFalse(phoneUtil.isPossibleNumber(number3));
-
-    assertFalse(phoneUtil.isPossibleNumber("+1 650 253 00000", "US"));
-    assertFalse(phoneUtil.isPossibleNumber("(650) 253-00000", "US"));
-    assertFalse(phoneUtil.isPossibleNumber("I want a Pizza", "US"));
-    assertFalse(phoneUtil.isPossibleNumber("253-000", "US"));
-    assertFalse(phoneUtil.isPossibleNumber("1 3000", "GB"));
-    assertFalse(phoneUtil.isPossibleNumber("+44 300", "GB"));
-  }
-
-  public void testIsViablePhoneNumber() {
-    // Only one or two digits before strange non-possible punctuation.
-    assertFalse(PhoneNumberUtil.isViablePhoneNumber("12. March"));
-    assertFalse(PhoneNumberUtil.isViablePhoneNumber("1+1+1"));
-    assertFalse(PhoneNumberUtil.isViablePhoneNumber("80+0"));
-    assertFalse(PhoneNumberUtil.isViablePhoneNumber("00"));
-    // Three digits is viable.
-    assertTrue(PhoneNumberUtil.isViablePhoneNumber("111"));
-    // Alpha numbers.
-    assertTrue(PhoneNumberUtil.isViablePhoneNumber("0800-4-pizza"));
-    assertTrue(PhoneNumberUtil.isViablePhoneNumber("0800-4-PIZZA"));
-    // Only one or two digits before possible punctuation followed by more digits.
-    assertTrue(PhoneNumberUtil.isViablePhoneNumber("1\u300034"));
-    assertFalse(PhoneNumberUtil.isViablePhoneNumber("1\u30003+4"));
-    // Unicode variants of possible starting character and other allowed punctuation/digits.
-    assertTrue(PhoneNumberUtil.isViablePhoneNumber("\uFF081\uFF09\u30003456789"));
-    // Testing a leading + is okay.
-    assertTrue(PhoneNumberUtil.isViablePhoneNumber("+1\uFF09\u30003456789"));
-  }
-
-  public void testExtractPossibleNumber() {
-    // Removes preceding funky punctuation and letters but leaves the rest untouched.
-    assertEquals("0800-345-600", PhoneNumberUtil.extractPossibleNumber("Tel:0800-345-600"));
-    assertEquals("0800 FOR PIZZA", PhoneNumberUtil.extractPossibleNumber("Tel:0800 FOR PIZZA"));
-    // Should not remove plus sign
-    assertEquals("+800-345-600", PhoneNumberUtil.extractPossibleNumber("Tel:+800-345-600"));
-    // Should recognise wide digits as possible start values.
-    assertEquals("\uFF10\uFF12\uFF13",
-                 PhoneNumberUtil.extractPossibleNumber("\uFF10\uFF12\uFF13"));
-    // Dashes are not possible start values and should be removed.
-    assertEquals("\uFF11\uFF12\uFF13",
-                 PhoneNumberUtil.extractPossibleNumber("Num-\uFF11\uFF12\uFF13"));
-    // If not possible number present, return empty string.
-    assertEquals("", PhoneNumberUtil.extractPossibleNumber("Num-...."));
-    // Leading brackets are stripped - these are not used when parsing.
-    assertEquals("650) 253-0000", PhoneNumberUtil.extractPossibleNumber("(650) 253-0000"));
-  }
-
-  public void testMaybeStripNationalPrefix() {
-    String nationalPrefix = "34";
-    StringBuffer numberToStrip = new StringBuffer("34356778");
-    String strippedNumber = "356778";
-    String nationalRuleRegExp = "\\d{4,7}";
-    Pattern nationalRule = Pattern.compile(nationalRuleRegExp);
-    phoneUtil.maybeStripNationalPrefix(numberToStrip, nationalPrefix, "", nationalRule);
-    assertEquals("Should have had national prefix stripped.",
-                 strippedNumber, numberToStrip.toString());
-    // Retry stripping - now the number should not start with the national prefix, so no more
-    // stripping should occur.
-    phoneUtil.maybeStripNationalPrefix(numberToStrip, nationalPrefix, "", nationalRule);
-    assertEquals("Should have had no change - no national prefix present.",
-                 strippedNumber, numberToStrip.toString());
-    // Some countries have no national prefix. Repeat test with none specified.
-    nationalPrefix = "";
-    phoneUtil.maybeStripNationalPrefix(numberToStrip, nationalPrefix, "", nationalRule);
-    assertEquals("Should not strip anything with empty national prefix.",
-                 strippedNumber, numberToStrip.toString());
-    // If the resultant number doesn't match the national rule, it shouldn't be stripped.
-    nationalPrefix = "3";
-    numberToStrip = new StringBuffer("3123");
-    strippedNumber = "3123";
-    phoneUtil.maybeStripNationalPrefix(numberToStrip, nationalPrefix, "", nationalRule);
-    assertEquals("Should have had no change - after stripping, it wouldn't have matched " +
-                 "the national rule.",
-                 strippedNumber, numberToStrip.toString());
-  }
-
-  public void testMaybeStripInternationalPrefix() {
-    String internationalPrefix = "00[39]";
-    StringBuffer numberToStrip = new StringBuffer("0034567700-3898003");
-    // Note the dash is removed as part of the normalization.
-    StringBuffer strippedNumber = new StringBuffer("45677003898003");
-    assertEquals(true, phoneUtil.maybeStripInternationalPrefixAndNormalize(numberToStrip,
-                                                                           internationalPrefix));
-    assertEquals("The number supplied was not stripped of its international prefix.",
-                 strippedNumber.toString(), numberToStrip.toString());
-    // Now the number no longer starts with an IDD prefix, so it should now report false.
-    assertEquals(false, phoneUtil.maybeStripInternationalPrefixAndNormalize(numberToStrip,
-                                                                            internationalPrefix));
-
-    numberToStrip = new StringBuffer("00945677003898003");
-    assertEquals(true, phoneUtil.maybeStripInternationalPrefixAndNormalize(numberToStrip,
-                                                                           internationalPrefix));
-    assertEquals("The number supplied was not stripped of its international prefix.",
-                 strippedNumber.toString(), numberToStrip.toString());
-    // Test it works when the international prefix is broken up by spaces.
-    numberToStrip = new StringBuffer("00 9 45677003898003");
-    assertEquals(true, phoneUtil.maybeStripInternationalPrefixAndNormalize(numberToStrip,
-                                                                           internationalPrefix));
-    assertEquals("The number supplied was not stripped of its international prefix.",
-                 strippedNumber.toString(), numberToStrip.toString());
-    // Now the number no longer starts with an IDD prefix, so it should now report false.
-    assertEquals(false, phoneUtil.maybeStripInternationalPrefixAndNormalize(numberToStrip,
-                                                                            internationalPrefix));
-
-    // Test the + symbol is also recognised and stripped.
-    numberToStrip = new StringBuffer("+45677003898003");
-    strippedNumber = new StringBuffer("45677003898003");
-    assertEquals(true, phoneUtil.maybeStripInternationalPrefixAndNormalize(numberToStrip,
-                                                                           internationalPrefix));
-    assertEquals("The number supplied was not stripped of the plus symbol.",
-                 strippedNumber.toString(), numberToStrip.toString());
-
-    // If the number afterwards is a zero, we should not strip this - no country code begins with 0.
-    numberToStrip = new StringBuffer("0090112-3123");
-    strippedNumber = new StringBuffer("00901123123");
-    assertEquals(false, phoneUtil.maybeStripInternationalPrefixAndNormalize(numberToStrip,
-                                                                            internationalPrefix));
-    assertEquals("The number supplied had a 0 after the match so shouldn't be stripped.",
-                 strippedNumber.toString(), numberToStrip.toString());
-    // Here the 0 is separated by a space from the IDD.
-    numberToStrip = new StringBuffer("009 0-112-3123");
-    assertEquals(false, phoneUtil.maybeStripInternationalPrefixAndNormalize(numberToStrip,
-                                                                            internationalPrefix));
-  }
-
-  public void testMaybeExtractCountryCode() {
-    PhoneMetadata metadata = phoneUtil.getPhoneMetadata("US");
-    // Note that for the US, the IDD is 011.
-    try {
-      String phoneNumber = "011112-3456789";
-      String strippedNumber = "123456789";
-      int countryCode = 1;
-      StringBuffer numberToFill = new StringBuffer();
-      assertEquals("Did not extract country code " + countryCode + " correctly.",
-                   countryCode,
-                   phoneUtil.maybeExtractCountryCode(phoneNumber, metadata, numberToFill));
-      // Should strip and normalize national significant number.
-      assertEquals("Did not strip off the country code correctly.",
-                   strippedNumber,
-                   numberToFill.toString());
-    } catch (NumberParseException e) {
-      fail("Should not have thrown an exception: " + e.toString());
-    }
-    try {
-      String phoneNumber = "+6423456789";
-      int countryCode = 64;
-      StringBuffer numberToFill = new StringBuffer();
-      assertEquals("Did not extract country code " + countryCode + " correctly.",
-                   countryCode,
-                   phoneUtil.maybeExtractCountryCode(phoneNumber, metadata, numberToFill));
-    } catch (NumberParseException e) {
-      fail("Should not have thrown an exception: " + e.toString());
-    }
-    try {
-      String phoneNumber = "2345-6789";
-      StringBuffer numberToFill = new StringBuffer();
-      assertEquals("Should not have extracted a country code - no international prefix present.",
-                   0,
-                   phoneUtil.maybeExtractCountryCode(phoneNumber, metadata, numberToFill));
-    } catch (NumberParseException e) {
-      fail("Should not have thrown an exception: " + e.toString());
-    }
-    try {
-      String phoneNumber = "0119991123456789";
-      StringBuffer numberToFill = new StringBuffer();
-      phoneUtil.maybeExtractCountryCode(phoneNumber, metadata,
-                                        numberToFill);
-      fail("Should have thrown an exception, no valid country code present.");
-    } catch (NumberParseException e) {
-      // Expected.
-      assertEquals("Wrong error type stored in exception.",
-                   NumberParseException.ErrorType.INVALID_COUNTRY_CODE,
-                   e.getErrorType());
-    }
-    try {
-      String phoneNumber = "(1 610) 619 4466";
-      int countryCode = 1;
-      StringBuffer numberToFill = new StringBuffer();
-      assertEquals("Should have extracted the country code of the region passed in",
-                   countryCode,
-                   phoneUtil.maybeExtractCountryCode(phoneNumber, metadata, numberToFill));
-    } catch (NumberParseException e) {
-      fail("Should not have thrown an exception: " + e.toString());
-    }
-    try {
-      String phoneNumber = "(1 610) 619 446";
-      StringBuffer numberToFill = new StringBuffer();
-      assertEquals("Should not have extracted a country code - invalid number after extraction " +
-                   "of uncertain country code.",
-                   0,
-                   phoneUtil.maybeExtractCountryCode(phoneNumber, metadata, numberToFill));
-    } catch (NumberParseException e) {
-      fail("Should not have thrown an exception: " + e.toString());
-    }
-    try {
-      String phoneNumber = "(1 610) 619 43 446";
-      StringBuffer numberToFill = new StringBuffer();
-      assertEquals("Should not have extracted a country code - invalid number both before and " +
-                   "after extraction of uncertain country code.",
-                   0,
-                   phoneUtil.maybeExtractCountryCode(phoneNumber, metadata,
-                                                     numberToFill));
-    } catch (NumberParseException e) {
-      fail("Should not have thrown an exception: " + e.toString());
-    }
-  }
-
-  public void testParseNationalNumber() throws Exception {
-    PhoneNumber nzNumber =
-        PhoneNumber.newBuilder().setCountryCode(64).setNationalNumber(33316005L).build();
-
-    // National prefix attached.
-    assertEquals(nzNumber, phoneUtil.parse("033316005", "NZ"));
-    assertEquals(nzNumber, phoneUtil.parse("33316005", "NZ"));
-    // National prefix attached and some formatting present.
-    assertEquals(nzNumber, phoneUtil.parse("03-331 6005", "NZ"));
-    assertEquals(nzNumber, phoneUtil.parse("03 331 6005", "NZ"));
-    // Test case with alpha characters.
-    PhoneNumber tollfreeNumber =
-        PhoneNumber.newBuilder().setCountryCode(64).setNationalNumber(800332005L).build();
-    assertEquals(tollfreeNumber, phoneUtil.parse("0800 DDA 005", "NZ"));
-    PhoneNumber premiumNumber =
-        PhoneNumber.newBuilder().setCountryCode(64).setNationalNumber(9003326005L).build();
-    assertEquals(premiumNumber, phoneUtil.parse("0900 DDA 6005", "NZ"));
-    // Not enough alpha characters for them to be considered intentional, so they are stripped.
-    assertEquals(premiumNumber, phoneUtil.parse("0900 332 6005a", "NZ"));
-    assertEquals(premiumNumber, phoneUtil.parse("0900 332 600a5", "NZ"));
-    assertEquals(premiumNumber, phoneUtil.parse("0900 332 600A5", "NZ"));
-    assertEquals(premiumNumber, phoneUtil.parse("0900 a332 600A5", "NZ"));
-
-    // Testing international prefixes.
-    // Should strip country code.
-    assertEquals(nzNumber, phoneUtil.parse("0064 3 331 6005", "NZ"));
-    // Try again, but this time we have an international number with Region Code US. It should
-    // recognise the country code and parse accordingly.
-    assertEquals(nzNumber, phoneUtil.parse("01164 3 331 6005", "US"));
-    assertEquals(nzNumber, phoneUtil.parse("+64 3 331 6005", "US"));
-
-    // Test for http://b/issue?id=2247493
-    PhoneNumber nzNumber2 =
-        PhoneNumber.newBuilder().setCountryCode(64).setNationalNumber(64123456L).build();
-    assertEquals(nzNumber2, phoneUtil.parse("64(0)64123456", "NZ"));
-
-    PhoneNumber usNumber =
-        PhoneNumber.newBuilder().setCountryCode(1).setNationalNumber(6503336000L).build();
-    assertEquals(usNumber, phoneUtil.parse("+1 (650) 333-6000", "NZ"));
-    assertEquals(usNumber, phoneUtil.parse("1-650-333-6000", "US"));
-    // Calling the US number from Singapore by using different service providers
-    // 1st test: calling using SingTel IDD service (IDD is 001)
-    assertEquals(usNumber, phoneUtil.parse("0011-650-333-6000", "SG"));
-    // 2nd test: calling using StarHub IDD service (IDD is 008)
-    assertEquals(usNumber, phoneUtil.parse("0081-650-333-6000", "SG"));
-    // 3rd test: calling using SingTel V019 service (IDD is 019)
-    assertEquals(usNumber, phoneUtil.parse("0191-650-333-6000", "SG"));
-    // Calling the US number from Poland
-    assertEquals(usNumber, phoneUtil.parse("0~01-650-333-6000", "PL"));
-    // Check it doesn't use the '1' as a country code when parsing if the phone number was already
-    // possible.
-    
-    PhoneNumber usNumber2 =
-        PhoneNumber.newBuilder().setCountryCode(1).setNationalNumber(1234567890L).build();
-    assertEquals(usNumber2, phoneUtil.parse("123-456-7890", "US"));
-
-    PhoneNumber itNumber =
-        PhoneNumber.newBuilder().setCountryCode(39).setNationalNumber(236618300L)
-            .setItalianLeadingZero(true).build();
-    assertEquals(itNumber, phoneUtil.parse("+39 02-36618 300", "NZ"));
-    assertEquals(itNumber, phoneUtil.parse("02-36618 300", "IT"));
-
-    PhoneNumber itNumber2 =
-        PhoneNumber.newBuilder().setCountryCode(39).setNationalNumber(312345678L).build();
-    assertEquals(itNumber2, phoneUtil.parse("312 345 678", "IT"));
-
-    // Check that using a "/" is fine in a phone number.
-    PhoneNumber deNumber =
-        PhoneNumber.newBuilder().setCountryCode(49).setNationalNumber(12345678L).build();
-    assertEquals(deNumber, phoneUtil.parse("123/45678", "DE"));
-
-    // Test parsing mobile numbers of Argentina.
-    PhoneNumber arNumber =
-        PhoneNumber.newBuilder().setCountryCode(54).setNationalNumber(93435551212L).build();
-    assertEquals(arNumber, phoneUtil.parse("+54 9 343 555 1212", "AR"));
-    assertEquals(arNumber, phoneUtil.parse("0343 15 555 1212", "AR"));
-
-    PhoneNumber arNumber2 =
-        PhoneNumber.newBuilder().setCountryCode(54).setNationalNumber(93715654320L).build();
-    assertEquals(arNumber2, phoneUtil.parse("+54 9 3715 65 4320", "AR"));
-    assertEquals(arNumber2, phoneUtil.parse("03715 15 65 4320", "AR"));
-
-    // Test parsing fixed-line numbers of Argentina.
-    PhoneNumber arNumber3 =
-        PhoneNumber.newBuilder().setCountryCode(54).setNationalNumber(1137970000L).build();
-    assertEquals(arNumber3, phoneUtil.parse("+54 11 3797 0000", "AR"));
-    assertEquals(arNumber3, phoneUtil.parse("011 3797 0000", "AR"));