wnob commented on code in PR #209:
URL: https://github.com/apache/calcite-avatica/pull/209#discussion_r1110457195


##########
core/src/test/java/org/apache/calcite/avatica/util/TimeFromNumberAccessorTest.java:
##########
@@ -36,112 +35,90 @@
  */
 public class TimeFromNumberAccessorTest {
 
+  private static final Calendar UTC =
+      Calendar.getInstance(TimeZone.getTimeZone("UTC"), Locale.ROOT);
+
+  // UTC+5:30
+  private static final TimeZone IST_ZONE = 
TimeZone.getTimeZone("Asia/Kolkata");
+
   private Cursor.Accessor instance;
   private Calendar localCalendar;
-  private Object value;
+  private Long value;
 
   /**
    * Setup test environment by creating a {@link 
AbstractCursor.TimeFromNumberAccessor} that reads
    * from the instance variable {@code value}.
    */
   @Before public void before() {
     final AbstractCursor.Getter getter = new LocalGetter();
-    localCalendar = Calendar.getInstance(TimeZone.getDefault(), Locale.ROOT);
+    localCalendar = Calendar.getInstance(IST_ZONE, Locale.ROOT);
     instance = new AbstractCursor.TimeFromNumberAccessor(getter,
-        localCalendar);
+        localCalendar, false);
   }
 
   /**
-   * Test {@code getString()} returns the same value as the input time.
-   */
-  @Test public void testString() throws SQLException {
-    value = 0;
-    assertThat(instance.getString(), is("00:00:00"));
-
-    value = DateTimeUtils.MILLIS_PER_DAY - 1000;
-    assertThat(instance.getString(), is("23:59:59"));
-  }
-
-  /**
-   * Test {@code getTime()} returns the same value as the input time for the 
local calendar.
+   * Test {@code getTime()} and {@code getTimestamp()} return the same instant 
as the input time for
+   * the connection default calendar.
    */
   @Test public void testTime() throws SQLException {
-    value = 0;
-    assertThat(instance.getTime(localCalendar), is(Time.valueOf("00:00:00")));
+    value = 12345L;
 
-    value = DateTimeUtils.MILLIS_PER_DAY - 1000;
-    assertThat(instance.getTime(localCalendar), is(Time.valueOf("23:59:59")));
+    assertThat(instance.getTime(null), is(new Time(value)));
+    assertThat(instance.getTimestamp(null), is(new Timestamp(value)));
   }
 
   /**
-   * Test {@code getTime()} handles time zone conversions relative to the 
local calendar and not
-   * UTC.
+   * Test {@code getTime()} and {@code getTimestamp()} handle time zone 
conversions relative to the
+   * provided calendar.
    */
   @Test public void testTimeWithCalendar() throws SQLException {
-    final int offset = localCalendar.getTimeZone().getOffset(0);

Review Comment:
   Ya, this is basically how I was feeling when I organized that meeting to 
look into parallelizing this. I think I have to just do the timestamps 
separately from the times, and that's probably as good as it's going to get in 
terms of breaking this up.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to