summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNarayan Kamath <narayan@google.com>2014-09-05 10:55:20 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2014-09-05 10:55:20 +0000
commitaeecf3ecfd7b6619db531e8febb4d58bbbc0f992 (patch)
treeb6278c8224207b515dc956c5926f87f179d25d73
parent32adcb4a34b40479154390a4f92d85805712b58c (diff)
parent2f3e9b30fb2646b9c9294825cf91d2b0dc3b57c5 (diff)
downloadlibcore-aeecf3ecfd7b6619db531e8febb4d58bbbc0f992.zip
libcore-aeecf3ecfd7b6619db531e8febb4d58bbbc0f992.tar.gz
libcore-aeecf3ecfd7b6619db531e8febb4d58bbbc0f992.tar.bz2
Merge "Make sure calendars are compared correctly."
-rw-r--r--luni/src/test/java/libcore/java/util/CalendarTest.java14
1 files changed, 11 insertions, 3 deletions
diff --git a/luni/src/test/java/libcore/java/util/CalendarTest.java b/luni/src/test/java/libcore/java/util/CalendarTest.java
index b2f6b94..e0e1a35 100644
--- a/luni/src/test/java/libcore/java/util/CalendarTest.java
+++ b/luni/src/test/java/libcore/java/util/CalendarTest.java
@@ -17,6 +17,7 @@
package libcore.java.util;
import java.util.Calendar;
+import java.util.Date;
import java.util.GregorianCalendar;
import java.util.Locale;
import java.util.TimeZone;
@@ -245,14 +246,21 @@ public class CalendarTest extends junit.framework.TestCase {
// here. We should add a targetSdkVersion based check and throw for each of these
// cases.
public void test_nullLocale() {
- assertEquals(
+ assertCalendarConfigEquals(
Calendar.getInstance(Locale.getDefault()),
Calendar.getInstance((Locale) null));
- assertEquals(
+ assertCalendarConfigEquals(
Calendar.getInstance(TimeZone.getDefault(), Locale.getDefault()),
Calendar.getInstance(TimeZone.getDefault(), null));
- assertEquals(
+ assertCalendarConfigEquals(
new GregorianCalendar(Locale.getDefault()),
new GregorianCalendar((Locale) null));
}
+
+ public void assertCalendarConfigEquals(Calendar a, Calendar b) {
+ Date d = new Date();
+ a.setTime(d);
+ b.setTime(d);
+ assertEquals(a, b);
+ }
}