From e124486951948174be956d4ca65807c097d68444 Mon Sep 17 00:00:00 2001 From: Sebastian Bazley Date: Mon, 2 Mar 2015 19:44:39 +0000 Subject: [PATCH] Simplify git-svn-id: https://svn.apache.org/repos/asf/commons/proper/lang/trunk@1663410 13f79535-47bb-0310-9956-ffa450edef68 --- .../lang3/time/FastDateParserSDFTest.java | 21 +++++++------------ 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/src/test/java/org/apache/commons/lang3/time/FastDateParserSDFTest.java b/src/test/java/org/apache/commons/lang3/time/FastDateParserSDFTest.java index f08beccaa..31e583fb0 100644 --- a/src/test/java/org/apache/commons/lang3/time/FastDateParserSDFTest.java +++ b/src/test/java/org/apache/commons/lang3/time/FastDateParserSDFTest.java @@ -107,6 +107,7 @@ public static Collection data() { private final String input; private final Locale locale; private final boolean valid; + private final TimeZone timeZone = TimeZone.getDefault(); public FastDateParserSDFTest(String format, String input, Locale locale, boolean valid) { this.format = format; @@ -117,30 +118,24 @@ public FastDateParserSDFTest(String format, String input, Locale locale, boolean @Test public void testOriginal() throws Exception { - final SimpleDateFormat sdf = new SimpleDateFormat(format, locale); - final TimeZone timeZone = TimeZone.getDefault(); - final DateParser fdf = new FastDateParser(format, timeZone, locale); - checkParse(locale, sdf, fdf, input); + checkParse(input); } @Test public void testUpperCase() throws Exception { - final SimpleDateFormat sdf = new SimpleDateFormat(format, locale); - final TimeZone timeZone = TimeZone.getDefault(); - final DateParser fdf = new FastDateParser(format, timeZone , locale); - checkParse(locale, sdf, fdf, input.toUpperCase(locale)); + checkParse(input.toUpperCase(locale)); } @Test @Ignore // not currently supported public void testLowerCase() throws Exception { - final SimpleDateFormat sdf = new SimpleDateFormat(format, locale); - final TimeZone timeZone = TimeZone.getDefault(); - final DateParser fdf = new FastDateParser(format, timeZone , locale); - checkParse(locale, sdf, fdf, input.toLowerCase(locale)); + checkParse(input.toLowerCase(locale)); } - private void checkParse(final Locale locale, final SimpleDateFormat sdf, final DateParser fdf, final String formattedDate) throws ParseException { + private void checkParse(final String formattedDate) throws ParseException { + final SimpleDateFormat sdf = new SimpleDateFormat(format, locale); + sdf.setTimeZone(timeZone); + final DateParser fdf = new FastDateParser(format, timeZone, locale); Date expectedTime=null; Class sdfE = null; try {