Reviewers: rice,
Description:
Fix bug 2822942 Remove calls to System.currentTimeMillis in tests
Review by: r...@google.com
Please review this at http://gwt-code-reviews.appspot.com/849801/show
Affected files:
M user/test/com/google/gwt/emultest/java/sql/SqlDateTest.java
M user/test/com/google/gwt/emultest/java/sql/SqlTimeTest.java
M user/test/com/google/gwt/emultest/java/sql/SqlTimestampTest.java
Index: user/test/com/google/gwt/emultest/java/sql/SqlDateTest.java
===================================================================
--- user/test/com/google/gwt/emultest/java/sql/SqlDateTest.java (revision
8697)
+++ user/test/com/google/gwt/emultest/java/sql/SqlDateTest.java (working
copy)
@@ -36,7 +36,7 @@
}
public void testInternalPrecision() {
- long millis = System.currentTimeMillis();
+ long millis = 1000000;
Date now = new Date(millis);
Date after = new Date(now.getTime() + 1);
Date before = new Date(now.getTime() - 1);
Index: user/test/com/google/gwt/emultest/java/sql/SqlTimeTest.java
===================================================================
--- user/test/com/google/gwt/emultest/java/sql/SqlTimeTest.java (revision
8697)
+++ user/test/com/google/gwt/emultest/java/sql/SqlTimeTest.java (working
copy)
@@ -124,7 +124,7 @@
}
public void testInternalPrecision() {
- long millis = System.currentTimeMillis();
+ long millis = 1000000;
Time today = new Time(millis);
Time after = new Time(today.getTime() + 1);
Time before = new Time(today.getTime() - 1);
Index: user/test/com/google/gwt/emultest/java/sql/SqlTimestampTest.java
===================================================================
--- user/test/com/google/gwt/emultest/java/sql/SqlTimestampTest.java
(revision 8697)
+++ user/test/com/google/gwt/emultest/java/sql/SqlTimestampTest.java
(working copy)
@@ -41,7 +41,7 @@
* dates.
*/
public void testDateComparison() {
- long now = System.currentTimeMillis();
+ long now = 1000000;
Date d = new Date(now);
Timestamp t = new Timestamp(d.getTime());
@@ -70,7 +70,7 @@
}
public void testNanosAffectTime() {
- long now = System.currentTimeMillis();
+ long now = 1000000;
int millis = (int) (now % 1000);
Timestamp t = new Timestamp(now);
@@ -85,7 +85,7 @@
}
public void testNanosComparison() {
- long now = System.currentTimeMillis();
+ long now = 1000000;
Timestamp t = new Timestamp(now);
t.setNanos(0);
@@ -107,7 +107,7 @@
}
public void testNanosRange() {
- long now = System.currentTimeMillis();
+ long now = 1000000;
Timestamp t = new Timestamp(now);
assertEquals(now, t.getTime());
@@ -134,7 +134,7 @@
public void testTimeAffectsNanos() {
// A value 5 millis past the current second
- long now = (System.currentTimeMillis() / 1000) * 1000 + 5;
+ long now = (1000000 / 1000) * 1000 + 5;
Timestamp t = new Timestamp(now);
assertEquals(5000000, t.getNanos());
--
http://groups.google.com/group/Google-Web-Toolkit-Contributors