lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dna...@apache.org
Subject cvs commit: jakarta-lucene/src/test/org/apache/lucene/document TestDateTools.java
Date Mon, 11 Oct 2004 20:32:44 GMT
dnaber      2004/10/11 13:32:44

  Modified:    src/test/org/apache/lucene/document TestDateTools.java
  Log:
  trying to make the testcase timezone independent
  
  Revision  Changes    Path
  1.2       +12 -5     jakarta-lucene/src/test/org/apache/lucene/document/TestDateTools.java
  
  Index: TestDateTools.java
  ===================================================================
  RCS file: /home/cvs/jakarta-lucene/src/test/org/apache/lucene/document/TestDateTools.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- TestDateTools.java	5 Sep 2004 21:28:42 -0000	1.1
  +++ TestDateTools.java	11 Oct 2004 20:32:44 -0000	1.2
  @@ -52,11 +52,18 @@
   
     }
     
  -  public void testStringtotime() throws ParseException {
  -    long time = DateTools.stringToTime("197001010100");
  -    assertEquals(0, time);
  -    time = DateTools.stringToTime("197001010102");
  -    assertEquals(120000, time);
  +  public void testStringtoTime() throws ParseException {
  +    long time = DateTools.stringToTime("197001010000");
  +    Calendar cal = Calendar.getInstance();
  +    cal.set(1970, 0, 1,    // year=1970, month=january, day=1
  +        0, 0, 0);          // hour, minute, second
  +    cal.set(Calendar.MILLISECOND, 0);
  +    assertEquals(cal.getTime().getTime(), time);
  +    cal.set(1980, 1, 2,    // year=1980, month=february, day=2
  +        11, 5, 0);          // hour, minute, second
  +    cal.set(Calendar.MILLISECOND, 0);
  +    time = DateTools.stringToTime("198002021105");
  +    assertEquals(cal.getTime().getTime(), time);
     }
     
     public void testDateAndTimetoString() throws ParseException {
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: lucene-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: lucene-dev-help@jakarta.apache.org


Mime
View raw message