Use less mysterious names.

This commit is contained in:
Gary Gregory 2020-12-29 13:23:19 -05:00
parent 8aff0a08f2
commit cd013c9239
1 changed files with 14 additions and 13 deletions

View File

@ -104,8 +104,8 @@ public class FastDateParserTest {
); );
} }
private static Calendar initializeCalendar(final TimeZone tz) { private static Calendar initializeCalendar(final TimeZone timeZone) {
final Calendar cal = Calendar.getInstance(tz); final Calendar cal = Calendar.getInstance(timeZone);
cal.set(Calendar.YEAR, 2001); cal.set(Calendar.YEAR, 2001);
cal.set(Calendar.MONTH, 1); // not daylight savings cal.set(Calendar.MONTH, 1); // not daylight savings
cal.set(Calendar.DAY_OF_MONTH, 4); cal.set(Calendar.DAY_OF_MONTH, 4);
@ -119,18 +119,19 @@ public class FastDateParserTest {
private final TriFunction<String, TimeZone, Locale, DateParser> dateParserProvider = (format, timeZone, private final TriFunction<String, TimeZone, Locale, DateParser> dateParserProvider = (format, timeZone,
locale) -> new FastDateParser(format, timeZone, locale, null); locale) -> new FastDateParser(format, timeZone, locale, null);
static void checkParse(final Locale locale, final Calendar cal, final SimpleDateFormat sdf, final DateParser fdf) { static void checkParse(final Locale locale, final Calendar cal, final SimpleDateFormat simpleDateFormat,
final String formattedDate = sdf.format(cal.getTime()); final DateParser dateParser) {
checkParse(locale, sdf, fdf, formattedDate); final String formattedDate = simpleDateFormat.format(cal.getTime());
checkParse(locale, sdf, fdf, formattedDate.toLowerCase(locale)); checkParse(locale, simpleDateFormat, dateParser, formattedDate);
checkParse(locale, sdf, fdf, formattedDate.toUpperCase(locale)); checkParse(locale, simpleDateFormat, dateParser, formattedDate.toLowerCase(locale));
checkParse(locale, simpleDateFormat, dateParser, formattedDate.toUpperCase(locale));
} }
static void checkParse(final Locale locale, final SimpleDateFormat sdf, final DateParser fdf, static void checkParse(final Locale locale, final SimpleDateFormat simpleDateFormat, final DateParser dateParser,
final String formattedDate) { final String formattedDate) {
try { try {
final Date expectedTime = sdf.parse(formattedDate); final Date expectedTime = simpleDateFormat.parse(formattedDate);
final Date actualTime = fdf.parse(formattedDate); final Date actualTime = dateParser.parse(formattedDate);
assertEquals(expectedTime, actualTime, "locale : " + locale + ", formattedDate : " + formattedDate assertEquals(expectedTime, actualTime, "locale : " + locale + ", formattedDate : " + formattedDate
+ ", Java: " + SystemUtils.JAVA_RUNTIME_VERSION + "\n"); + ", Java: " + SystemUtils.JAVA_RUNTIME_VERSION + "\n");
} catch (final Exception e) { } catch (final Exception e) {