otis        2003/02/15 12:16:07

  Modified:    src/test/org/apache/lucene/queryParser TestQueryParser.java
  Log:
  - Modified to use localized date strings.
  Submitted by: Christoph Kiehl
  Reviewed by: Otis
  
  Revision  Changes    Path
  1.19      +13 -4     
jakarta-lucene/src/test/org/apache/lucene/queryParser/TestQueryParser.java
  
  Index: TestQueryParser.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-lucene/src/test/org/apache/lucene/queryParser/TestQueryParser.java,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- TestQueryParser.java      23 Jan 2003 01:28:48 -0000      1.18
  +++ TestQueryParser.java      15 Feb 2003 20:16:07 -0000      1.19
  @@ -281,11 +281,20 @@
        return DateField.dateToString(df.parse(s));
       }
   
  +     public String getLocalizedDate(int year, int month, int day) {
  +             DateFormat df = DateFormat.getDateInstance(DateFormat.SHORT);
  +             Calendar calendar = Calendar.getInstance();
  +             calendar.set(year, month, day);
  +             return df.format(calendar.getTime());
  +     }
  +
       public void testDateRange() throws Exception {
  -     assertQueryEquals("[ 1/1/02 TO 1/4/02]", null,
  -         "[" + getDate("1/1/02") + "-" + getDate("1/4/02") + "]");
  -     assertQueryEquals("{  1/1/02    1/4/02   }", null,
  -         "{" + getDate("1/1/02") + "-" + getDate("1/4/02") + "}");
  +    String startDate = getLocalizedDate(2002, 1, 1);
  +    String endDate = getLocalizedDate(2002, 1, 4); 
  +     assertQueryEquals("[ " + startDate + " TO " + endDate + "]", null,
  +         "[" + getDate(startDate) + "-" + getDate(endDate) + "]");
  +     assertQueryEquals("{  " + startDate + "    " + endDate + "   }", null,
  +         "{" + getDate(startDate) + "-" + getDate(endDate) + "}");
       }
   
       public void testEscaped() throws Exception {
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to