summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNarayan Kamath <narayan@google.com>2016-01-05 14:17:01 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2016-01-05 14:17:01 +0000
commite357d594b29d657cbc532adbf5d30e51d21765e6 (patch)
tree89afd9abcf74ba57d0fcdc237ffe489944635cb5
parent04ac7b87c1db374daa1bafda60557f9e99ab93be (diff)
parent008c8fa06b14e8420b0cd575e0c14243c82ca6be (diff)
downloadapache-harmony-e357d594b29d657cbc532adbf5d30e51d21765e6.tar.gz
Merge "Fix TimeStampTest."
-rw-r--r--sql/src/test/java/org/apache/harmony/sql/tests/java/sql/TimestampTest.java21
1 files changed, 5 insertions, 16 deletions
diff --git a/sql/src/test/java/org/apache/harmony/sql/tests/java/sql/TimestampTest.java b/sql/src/test/java/org/apache/harmony/sql/tests/java/sql/TimestampTest.java
index 8de472a..98de92d 100644
--- a/sql/src/test/java/org/apache/harmony/sql/tests/java/sql/TimestampTest.java
+++ b/sql/src/test/java/org/apache/harmony/sql/tests/java/sql/TimestampTest.java
@@ -77,10 +77,8 @@ public class TimestampTest extends TestCase {
static String STRING_INVALID3 = "21-43-48";
- // A timepoint in the correct format but with numeric values out of range
- // ...this is accepted despite being a crazy date specification
- // ...it is treated as the correct format date 3000-06-08 12:40:06.875 !!
- static String STRING_OUTRANGE = "2999-15-99 35:99:66.875";
+ // A timepoint in the correct format but with numeric values out of range.
+ static String STRING_INVALID_OUTRANGE = "2999-15-99 35:99:66.875";
static long[] TIME_ARRAY = { TIME_TEST1, TIME_TEST2, TIME_TEST3 };
@@ -111,7 +109,7 @@ public class TimestampTest extends TestCase {
static String[] STRING_JP_ARRAY = { "19:45:20", "07:17:59", "22:14:40" };
static String[] INVALID_STRINGS = { STRING_INVALID1, STRING_INVALID2,
- STRING_INVALID3 };
+ STRING_INVALID3, STRING_INVALID_OUTRANGE };
// Timezones
static String TZ_LONDON = "GMT"; // GMT (!) PS London != GMT (?!?)
@@ -313,15 +311,6 @@ public class TimestampTest extends TestCase {
assertEquals(theTimestamp, theTimestamp2);
} // end for
- // Test for a string in correct format but with number values out of
- // range
- Timestamp theTimestamp = Timestamp.valueOf(STRING_OUTRANGE);
- assertNotNull(theTimestamp);
- /*
- * System.out.println("testValueOfString: outrange timestamp: " +
- * theTimestamp.toString() );
- */
-
for (String element : INVALID_STRINGS) {
try {
Timestamp.valueOf(element);
@@ -612,8 +601,8 @@ public class TimestampTest extends TestCase {
t1.setTime(Long.MIN_VALUE);
t2.setDate(Integer.MIN_VALUE);
- assertEquals(1, t1.compareTo(t2));
- assertEquals(-1, t2.compareTo(t1));
+ assertEquals(-1, t1.compareTo(t2));
+ assertEquals(1, t2.compareTo(t1));
t1.setTime(Long.MAX_VALUE);
t2.setTime(Long.MAX_VALUE - 1);