WeekDateTest.java revision 2715
342N/A * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. 342N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 342N/A * This code is free software; you can redistribute it and/or modify it 342N/A * under the terms of the GNU General Public License version 2 only, as 342N/A * published by the Free Software Foundation. 342N/A * This code is distributed in the hope that it will be useful, but WITHOUT 342N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 342N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 342N/A * version 2 for more details (a copy is included in the LICENSE file that 342N/A * accompanied this code). 342N/A * You should have received a copy of the GNU General Public License version 342N/A * 2 along with this work; if not, write to the Free Software Foundation, 342N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 342N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 342N/A * or visit www.oracle.com if you need additional information or have any 342N/A * @summary Unit test for week date support 845N/A // Week dates are in the ISO numbering for day-of-week. 342N/A // Calendar year-date, Week year-date 342N/A {{
2005,
01,
01}, {
2004,
53,
6}},
342N/A {{
2005,
01,
02}, {
2004,
53,
7}},
342N/A {{
2005,
12,
31}, {
2005,
52,
6}},
342N/A {{
2007,
01,
01}, {
2007,
01,
1}},
342N/A {{
2007,
12,
30}, {
2007,
52,
7}},
342N/A {{
2007,
12,
31}, {
2008,
01,
1}},
342N/A {{
2008,
01,
01}, {
2008,
01,
2}},
342N/A {{
2008,
12,
29}, {
2009,
01,
1}},
845N/A {{
2008,
12,
31}, {
2009,
01,
3}},
845N/A {{
2009,
01,
01}, {
2009,
01,
4}},
845N/A {{
2009,
12,
31}, {
2009,
53,
4}},
845N/A {{
2010,
01,
03}, {
2009,
53,
7}},
845N/A {{
2009,
12,
31}, {
2009,
53,
4}},
845N/A {{
2010,
01,
01}, {
2009,
53,
5}},
342N/A {{
2010,
01,
02}, {
2009,
53,
6}},
845N/A {{
2010,
01,
03}, {
2009,
53,
7}},
342N/A {{
2008,
12,
28}, {
2008,
52,
7}},
845N/A {{
2008,
12,
29}, {
2009,
01,
1}},
342N/A {{
2008,
12,
30}, {
2009,
01,
2}},
342N/A {{
2008,
12,
31}, {
2009,
01,
3}},
342N/A {{
2009,
01,
01}, {
2009,
01,
4}}
845N/A // Data for leniency test 342N/A {{
2008,
12,
28}, {
2009,
0,
7}},
342N/A {{
2008,
12,
21}, {
2009, -
1,
7}},
342N/A {{
2009,
1,
4}, {
2008,
53,
7}},
342N/A // Convert ISO 8601 day-of-week to Calendar.DAY_OF_WEEK. 845N/A "got=%4d-W%02d-%d, expected=%4d-W%02d-%d (not ISO day-of-week)",
1261N/A // Test getWeeksInWeekYear(). 1261N/A // If we avoid the first week of January and the last week of 1261N/A // December, getWeeksInWeekYear() and 1261N/A // getActualMaximum(WEEK_OF_YEAR) values should be the same. 1261N/A +
"getActualMaximum(WEEK_OF_YEAR) = %d%n",
// Test lenient mode with out of range values. // Convert ISO 8601 day-of-week to Calendar.DAY_OF_WEEK. // Use the raw dayOfWeek value as invalid data // Use GMT to avoid any surprises related DST transitions. // Setup the ISO 8601 compatible parameters