Reset PhoneNumberUtil singleton instance in ShortNumberUtilTest and make JUnit tests...
authorphilip.liard@gmail.com <philip.liard@gmail.com@ee073f10-1060-11df-b6a4-87a95322a99c>
Fri, 4 Nov 2011 12:02:25 +0000 (12:02 +0000)
committerphilip.liard@gmail.com <philip.liard@gmail.com@ee073f10-1060-11df-b6a4-87a95322a99c>
Fri, 4 Nov 2011 12:02:25 +0000 (12:02 +0000)
PhoneNumberUtil.resetInstance() should always be used instead. This omission should not be hidden by unit tests that fork.

That also makes the external version consistent with the internal one in which unit tests don't seem to be executed by default in isolated processes.

Review URL: http://codereview.appspot.com/5341042

git-svn-id: http://libphonenumber.googlecode.com/svn/trunk@381 ee073f10-1060-11df-b6a4-87a95322a99c

java/build.xml
java/pom.xml
java/test/com/google/i18n/phonenumbers/ShortNumberUtilTest.java

index 7cbd41838ac1379dcc1415c4103a2c70c30907a4..bab47323eda03e283e42b133858db7eb6e2fb2ed 100644 (file)
     <junit printsummary="yes">
       <classpath refid="test.classpath"/>
       <formatter type="xml"/>
-      <batchtest fork="yes" todir="${report.dir}">
+      <batchtest fork="no" todir="${report.dir}">
         <fileset dir="${test.dir}" includes="**/*Test.java"/>
       </batchtest>
     </junit>
index f4ff3bf37e0311357a41a1358765d4d04815a870..c266e7daf567aa7ee992d44666d5dcb4a31f61cf 100644 (file)
           </excludes>
         </configuration>
       </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-surefire-plugin</artifactId>
+        <version>2.10</version>
+        <configuration>
+          <forkMode>never</forkMode>
+        </configuration>
+      </plugin>
       <plugin>
         <groupId>org.apache.maven.plugins</groupId>
         <artifactId>maven-source-plugin</artifactId>
index b1ae29b85398e991da0961236b4dc33dfb10111b..8f0baf6c8554245fcd0a33bdf33f1918fe37ee78 100644 (file)
@@ -29,6 +29,7 @@ public class ShortNumberUtilTest extends TestCase {
       "/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProtoForTesting";
 
   public ShortNumberUtilTest() {
+    PhoneNumberUtil.resetInstance();
     PhoneNumberUtil phoneUtil = PhoneNumberUtil.getInstance(
         TEST_META_DATA_FILE_PREFIX,
         CountryCodeToRegionCodeMapForTesting.getCountryCodeToRegionCodeMap());