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