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 7cbd418..bab4732 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 f4ff3bf..c266e7d 100644 (file)
       </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>
         <version>2.1.2</version>
         <executions>
index b1ae29b..8f0baf6 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());