Java Code Examples for java.util.Calendar#FIELD_COUNT

The following examples show how to use java.util.Calendar#FIELD_COUNT . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: BuddhistCalendarTest.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 4956227: getLeastMaximum(WEEK_OF_MONTH) return diff. val. for Greg. and Buddhist Calendar
 */
static void testLeastMax() {
    Calendar bc = getBuddhistCalendar();
    // Specify THAI_LOCALE to get the same params for WEEK
    // calculations (6904680).
    Calendar gc = new GregorianCalendar(THAI_LOCALE);
    for (int f = 0; f < Calendar.FIELD_COUNT; f++) {
        if (f == ERA || f == YEAR) {
            continue;
        }
        int bn = bc.getLeastMaximum(f);
        int gn = gc.getLeastMaximum(f);
        if (bn != gn) {
            throw new RuntimeException("inconsistent Least Max value for " + Koyomi.getFieldName(f)
                                       + ": Buddhist=" + bn
                                       + ": Gregorian=" + gn);
        }
    }
}
 
Example 2
Source File: BuddhistCalendarTest.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 4956227: getLeastMaximum(WEEK_OF_MONTH) return diff. val. for Greg. and Buddhist Calendar
 */
static void testLeastMax() {
    Calendar bc = getBuddhistCalendar();
    // Specify THAI_LOCALE to get the same params for WEEK
    // calculations (6904680).
    Calendar gc = new GregorianCalendar(THAI_LOCALE);
    for (int f = 0; f < Calendar.FIELD_COUNT; f++) {
        if (f == ERA || f == YEAR) {
            continue;
        }
        int bn = bc.getLeastMaximum(f);
        int gn = gc.getLeastMaximum(f);
        if (bn != gn) {
            throw new RuntimeException("inconsistent Least Max value for " + Koyomi.getFieldName(f)
                                       + ": Buddhist=" + bn
                                       + ": Gregorian=" + gn);
        }
    }
}
 
Example 3
Source File: BuddhistCalendarTest.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 4956227: getLeastMaximum(WEEK_OF_MONTH) return diff. val. for Greg. and Buddhist Calendar
 */
static void testLeastMax() {
    Calendar bc = getBuddhistCalendar();
    // Specify THAI_LOCALE to get the same params for WEEK
    // calculations (6904680).
    Calendar gc = new GregorianCalendar(THAI_LOCALE);
    for (int f = 0; f < Calendar.FIELD_COUNT; f++) {
        if (f == ERA || f == YEAR) {
            continue;
        }
        int bn = bc.getLeastMaximum(f);
        int gn = gc.getLeastMaximum(f);
        if (bn != gn) {
            throw new RuntimeException("inconsistent Least Max value for " + Koyomi.getFieldName(f)
                                       + ": Buddhist=" + bn
                                       + ": Gregorian=" + gn);
        }
    }
}
 
Example 4
Source File: BuddhistCalendarTest.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 4956227: getLeastMaximum(WEEK_OF_MONTH) return diff. val. for Greg. and Buddhist Calendar
 */
static void testLeastMax() {
    Calendar bc = getBuddhistCalendar();
    // Specify THAI_LOCALE to get the same params for WEEK
    // calculations (6904680).
    Calendar gc = new GregorianCalendar(THAI_LOCALE);
    for (int f = 0; f < Calendar.FIELD_COUNT; f++) {
        if (f == ERA || f == YEAR) {
            continue;
        }
        int bn = bc.getLeastMaximum(f);
        int gn = gc.getLeastMaximum(f);
        if (bn != gn) {
            throw new RuntimeException("inconsistent Least Max value for " + Koyomi.getFieldName(f)
                                       + ": Buddhist=" + bn
                                       + ": Gregorian=" + gn);
        }
    }
}
 
Example 5
Source File: BuddhistCalendarTest.java    From jdk8u_jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 4956227: getLeastMaximum(WEEK_OF_MONTH) return diff. val. for Greg. and Buddhist Calendar
 */
static void testLeastMax() {
    Calendar bc = getBuddhistCalendar();
    // Specify THAI_LOCALE to get the same params for WEEK
    // calculations (6904680).
    Calendar gc = new GregorianCalendar(THAI_LOCALE);
    for (int f = 0; f < Calendar.FIELD_COUNT; f++) {
        if (f == ERA || f == YEAR) {
            continue;
        }
        int bn = bc.getLeastMaximum(f);
        int gn = gc.getLeastMaximum(f);
        if (bn != gn) {
            throw new RuntimeException("inconsistent Least Max value for " + Koyomi.getFieldName(f)
                                       + ": Buddhist=" + bn
                                       + ": Gregorian=" + gn);
        }
    }
}
 
Example 6
Source File: CalendarTest.java    From j2objc with Apache License 2.0 5 votes vote down vote up
/**
 * java.util.Calendar#isSet(int)
 */
public void test_isSet() {
    Calendar calendar = Calendar.getInstance();
    calendar.clear();
    for (int i = 0; i < Calendar.FIELD_COUNT; i++) {
        assertFalse(calendar.isSet(i));
    }
}