Fixed a broken test that would fail 0.1% of the time because it assumes that a Date has a non-zero millsecond field.
Patch by: jlabanca
Review by: jat (desk)
git-svn-id: https://google-web-toolkit.googlecode.com/svn/trunk@5638 8db76d5a-ed1c-0410-87a9-c151d255dfc7
diff --git a/user/test/com/google/gwt/emultest/java/sql/SqlTimestampTest.java b/user/test/com/google/gwt/emultest/java/sql/SqlTimestampTest.java
index 8717751..6213650 100644
--- a/user/test/com/google/gwt/emultest/java/sql/SqlTimestampTest.java
+++ b/user/test/com/google/gwt/emultest/java/sql/SqlTimestampTest.java
@@ -22,7 +22,7 @@
import java.util.Date;
/**
- * Tests {@link java.sql.Timestame}. We assume that the underlying
+ * Tests {@link java.sql.Timestamp}. We assume that the underlying
* {@link java.util.Date} implementation is correct and concentrate only on the
* differences between the two.
*/
@@ -32,6 +32,7 @@
/**
* Sets module name so that javascript compiler can operate.
*/
+ @Override
public String getModuleName() {
return "com.google.gwt.emultest.EmulSuite";
}
@@ -45,7 +46,11 @@
Date d = new Date(now);
Timestamp t = new Timestamp(d.getTime());
- t.setNanos(1);
+ if (now % 1000 == 0) {
+ t.setNanos(1000001);
+ } else {
+ t.setNanos(1);
+ }
// Timestamps are stored at second-level precision
Date d2 = new Date(t.getTime());