harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ghar...@apache.org
Subject svn commit: r407044 - in /incubator/harmony/enhanced/classlib/trunk/modules/luni: make/common/build.xml src/test/java/tests/api/java/util/CalendarTest.java
Date Tue, 16 May 2006 20:06:20 GMT
Author: gharley
Date: Tue May 16 13:06:19 2006
New Revision: 407044

URL: http://svn.apache.org/viewcvs?rev=407044&view=rev
Log:
HARMONY 452 : Defect in test case: tests.api.java.util.CalendarTest.test_setII

Modified:
    incubator/harmony/enhanced/classlib/trunk/modules/luni/make/common/build.xml
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/util/CalendarTest.java

Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/make/common/build.xml
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/luni/make/common/build.xml?rev=407044&r1=407043&r2=407044&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/make/common/build.xml (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/make/common/build.xml Tue May 16
13:06:19 2006
@@ -128,7 +128,6 @@
                     <exclude name="tests/api/java/net/URLClassLoaderTest.java" />
                     <exclude name="tests/api/java/net/URLConnectionTest.java" />
                     <exclude name="tests/api/java/net/URLTest.java" />
-                    <exclude name="tests/api/java/util/CalendarTest.java" />
                     <exclude name="tests/api/java/util/LocaleTest.java" />
                 </fileset>
             </batchtest>

Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/util/CalendarTest.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/util/CalendarTest.java?rev=407044&r1=407043&r2=407044&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/util/CalendarTest.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/util/CalendarTest.java
Tue May 16 13:06:19 2006
@@ -17,9 +17,12 @@
 
 import java.util.Calendar;
 import java.util.Date;
+import java.util.Locale;
 import java.util.TimeZone;
 
 public class CalendarTest extends junit.framework.TestCase {
+	
+	Locale defaultLocale;
 
 	/**
 	 * @tests java.util.Calendar#set(int, int)
@@ -343,24 +346,25 @@
 		cal.set(Calendar.DAY_OF_YEAR, 111);
 		cal.get(Calendar.YEAR);
 		cal.set(Calendar.MONTH, Calendar.MARCH);
+		cal.set(Calendar.AM_PM, Calendar.AM);
 		assertTrue("Incorrect result 14: " + cal.getTime(), cal.getTime()
 				.getTime() == 1016686800000L);
 
 		int hour = cal.get(Calendar.HOUR);
-		int ampm = cal.get(Calendar.AM_PM);
-		int setAMPMValue = ampm == 0 ? 1 : 0;
 		cal.set(Calendar.HOUR, hour);
-		cal.set(Calendar.AM_PM, setAMPMValue);
-		assertTrue("AM_PM not changed", cal.get(Calendar.AM_PM) == setAMPMValue);
+		cal.set(Calendar.AM_PM, Calendar.PM);
+		assertEquals("AM_PM not changed", Calendar.PM, cal.get(Calendar.AM_PM));
 		// setting AM_PM without HOUR should not have any affect
-		cal.set(Calendar.AM_PM, ampm);
-		assertTrue("AM_PM was changed 1",
-				cal.get(Calendar.AM_PM) == setAMPMValue);
+		cal.set(Calendar.AM_PM, Calendar.AM);
+		assertEquals("AM_PM was changed 1",
+				Calendar.AM, cal.get(Calendar.AM_PM));
 		int hourOfDay = cal.get(Calendar.HOUR_OF_DAY);
-		cal.set(Calendar.HOUR_OF_DAY, hourOfDay);
-		cal.set(Calendar.AM_PM, ampm);
-		assertTrue("AM_PM was changed 2",
-				cal.get(Calendar.AM_PM) == setAMPMValue);
+		hour = cal.get(Calendar.HOUR);
+		cal.set(Calendar.AM_PM, Calendar.PM);
+		assertEquals("AM_PM was changed 2",
+				Calendar.PM, cal.get(Calendar.AM_PM));
+		assertEquals(hour, cal.get(Calendar.HOUR));
+		assertEquals(hourOfDay + 12, cal.get(Calendar.HOUR_OF_DAY));
 	}
 
 	/**
@@ -412,8 +416,11 @@
 	}
 
 	protected void setUp() {
+		defaultLocale = Locale.getDefault();
+		Locale.setDefault(Locale.US);
 	}
 
 	protected void tearDown() {
+		Locale.setDefault(defaultLocale);
 	}
 }



Mime
View raw message