2 *******************************************************************************
\r
3 * Copyright (C) 2001-2010, International Business Machines Corporation and *
\r
4 * others. All Rights Reserved. *
\r
5 *******************************************************************************
\r
7 package com.ibm.icu.dev.test.calendar;
\r
8 import java.util.Date;
\r
10 import com.ibm.icu.util.Calendar;
\r
12 public class ChineseTestCase extends TestCase {
\r
15 * Initialize an object using a Julian day number and
\r
16 * the corresponding fields for the calendar being tested.
\r
18 * @param era the ERA field of tested calendar on the given Julian
\r
20 * @param year the YEAR field of tested calendar on the given
\r
22 * @param month the MONTH (1-based) field of tested calendar on
\r
23 * the given Julian day
\r
24 * @param isLeapMonth if true, treat month as a leap month
\r
25 * @param dayOfMonth the DAY_OF_MONTH field of tested calendar on the
\r
27 * @param dayOfWeek the DAY_OF_WEEK field of tested calendar on given
\r
30 public ChineseTestCase(double julian,
\r
31 int era, int year, int month,
\r
32 boolean isLeapMonth, int dayOfMonth, int dayOfWeek) {
\r
34 setTime(new Date(JULIAN_EPOCH + (long)(ONE_DAY * julian)));
\r
36 set(Calendar.ERA, era);
\r
37 set(Calendar.YEAR, year);
\r
38 set(Calendar.MONTH, month - 1);
\r
39 set(Calendar.IS_LEAP_MONTH, isLeapMonth?1:0);
\r
40 set(Calendar.DAY_OF_MONTH, dayOfMonth);
\r
41 set(Calendar.DAY_OF_WEEK, dayOfWeek);
\r
45 * Return a String representation of this test case's time.
\r
47 public String toString() {
\r
48 return dowToString(get(Calendar.DAY_OF_WEEK)) +
\r
49 get(Calendar.YEAR) + "of" + get(Calendar.ERA) +
\r
50 "/" + (get(Calendar.MONTH)+1) +
\r
51 (get(Calendar.IS_LEAP_MONTH)==1?"(leap)":"") + "/" +
\r
52 get(Calendar.DAY_OF_MONTH);
\r