218 {Locale.UK, "ee", "01", DayOfWeek.MONDAY}, 219 {Locale.UK, "c", "1", DayOfWeek.MONDAY}, 220 }; 221 } 222 223 @DataProvider(name="print_JapaneseChronology") 224 Object[][] provider_japaneseEra() { 225 return new Object[][] { 226 {ERA, TextStyle.FULL, 2, "Heisei"}, // Note: CLDR doesn't define "wide" Japanese era names. 227 {ERA, TextStyle.SHORT, 2, "Heisei"}, 228 {ERA, TextStyle.NARROW, 2, "H"}, 229 }; 230 }; 231 232 // Test data is dependent on localized resources. 233 @DataProvider(name="print_standalone") 234 Object[][] provider_StandaloneNames() { 235 return new Object[][] { 236 // standalone names for 2013-01-01 (Tue) 237 // Locale, TemporalField, TextStyle, expected text 238 {RUSSIAN, MONTH_OF_YEAR, TextStyle.FULL_STANDALONE, "\u042f\u043d\u0432\u0430\u0440\u044c"}, 239 {RUSSIAN, MONTH_OF_YEAR, TextStyle.SHORT_STANDALONE, "\u042f\u043d\u0432."}, 240 {FINNISH, DAY_OF_WEEK, TextStyle.FULL_STANDALONE, "tiistai"}, 241 {FINNISH, DAY_OF_WEEK, TextStyle.SHORT_STANDALONE, "ti"}, 242 }; 243 } 244 245 @Test(dataProvider="print") 246 public void test_format(TemporalField field, TextStyle style, int value, String expected) throws Exception { 247 getFormatter(field, style).formatTo(new MockFieldValue(field, value), buf); 248 assertEquals(buf.toString(), expected); 249 } 250 251 @Test(dataProvider="print_DayOfWeekData") 252 public void test_formatDayOfWeek(Locale locale, String pattern, String expected, DayOfWeek dayOfWeek) { 253 DateTimeFormatter formatter = getPatternFormatter(pattern).withLocale(locale); 254 String text = formatter.format(dayOfWeek); 255 assertEquals(text, expected); 256 } 257 258 @Test(dataProvider="print_JapaneseChronology") 259 public void test_formatJapaneseEra(TemporalField field, TextStyle style, int value, String expected) throws Exception { | 218 {Locale.UK, "ee", "01", DayOfWeek.MONDAY}, 219 {Locale.UK, "c", "1", DayOfWeek.MONDAY}, 220 }; 221 } 222 223 @DataProvider(name="print_JapaneseChronology") 224 Object[][] provider_japaneseEra() { 225 return new Object[][] { 226 {ERA, TextStyle.FULL, 2, "Heisei"}, // Note: CLDR doesn't define "wide" Japanese era names. 227 {ERA, TextStyle.SHORT, 2, "Heisei"}, 228 {ERA, TextStyle.NARROW, 2, "H"}, 229 }; 230 }; 231 232 // Test data is dependent on localized resources. 233 @DataProvider(name="print_standalone") 234 Object[][] provider_StandaloneNames() { 235 return new Object[][] { 236 // standalone names for 2013-01-01 (Tue) 237 // Locale, TemporalField, TextStyle, expected text 238 {RUSSIAN, MONTH_OF_YEAR, TextStyle.FULL_STANDALONE, "\u044f\u043d\u0432\u0430\u0440\u044c"}, 239 {RUSSIAN, MONTH_OF_YEAR, TextStyle.SHORT_STANDALONE, "\u044f\u043d\u0432."}, 240 {FINNISH, DAY_OF_WEEK, TextStyle.FULL_STANDALONE, "tiistai"}, 241 {FINNISH, DAY_OF_WEEK, TextStyle.SHORT_STANDALONE, "ti"}, 242 }; 243 } 244 245 @Test(dataProvider="print") 246 public void test_format(TemporalField field, TextStyle style, int value, String expected) throws Exception { 247 getFormatter(field, style).formatTo(new MockFieldValue(field, value), buf); 248 assertEquals(buf.toString(), expected); 249 } 250 251 @Test(dataProvider="print_DayOfWeekData") 252 public void test_formatDayOfWeek(Locale locale, String pattern, String expected, DayOfWeek dayOfWeek) { 253 DateTimeFormatter formatter = getPatternFormatter(pattern).withLocale(locale); 254 String text = formatter.format(dayOfWeek); 255 assertEquals(text, expected); 256 } 257 258 @Test(dataProvider="print_JapaneseChronology") 259 public void test_formatJapaneseEra(TemporalField field, TextStyle style, int value, String expected) throws Exception { |