From 2ed96f00f724c3331d6b56b6b5650b9632f43954 Mon Sep 17 00:00:00 2001 From: Duncan Jones Date: Sun, 12 Apr 2015 19:59:04 +0000 Subject: [PATCH] Refactored test into separate class, to avoid needless repeated execution by subclasses of the original test. git-svn-id: https://svn.apache.org/repos/asf/commons/proper/lang/trunk@1673049 13f79535-47bb-0310-9956-ffa450edef68 --- .../lang3/time/FastDateParserTest.java | 18 -------- .../FastDateParser_TimeZoneStrategyTest.java | 44 +++++++++++++++++++ 2 files changed, 44 insertions(+), 18 deletions(-) create mode 100644 src/test/java/org/apache/commons/lang3/time/FastDateParser_TimeZoneStrategyTest.java diff --git a/src/test/java/org/apache/commons/lang3/time/FastDateParserTest.java b/src/test/java/org/apache/commons/lang3/time/FastDateParserTest.java index c2a387f48..c4e0f95ae 100644 --- a/src/test/java/org/apache/commons/lang3/time/FastDateParserTest.java +++ b/src/test/java/org/apache/commons/lang3/time/FastDateParserTest.java @@ -21,7 +21,6 @@ import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; import java.io.Serializable; -import java.text.DateFormatSymbols; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Calendar; @@ -31,7 +30,6 @@ import java.util.HashMap; import java.util.Locale; import java.util.Map; import java.util.TimeZone; -import java.util.regex.Pattern; import org.apache.commons.lang3.SerializationUtils; import org.junit.Assert; @@ -641,20 +639,4 @@ public class FastDateParserTest { assertEquals(message+trial.three, cal.getTime(), parser.parse(dateStub+trial.three)); } } - - @Test - public void testTimeZoneStrategyPattern() { - Pattern tz = Pattern.compile(FastDateParser.TimeZoneStrategy.TZ_DATABASE); - Assert.assertFalse(tz.matcher("GMT-1234").matches()); - - for (Locale locale : Locale.getAvailableLocales()) { - final String[][] zones = DateFormatSymbols.getInstance(locale).getZoneStrings(); - for (final String[] zone : zones) { - for (String zoneExpr : zone) { - Assert.assertTrue(locale.getDisplayName() + ":" + zoneExpr, tz.matcher(zoneExpr).matches()); - } - } - } - } - } diff --git a/src/test/java/org/apache/commons/lang3/time/FastDateParser_TimeZoneStrategyTest.java b/src/test/java/org/apache/commons/lang3/time/FastDateParser_TimeZoneStrategyTest.java new file mode 100644 index 000000000..e97462770 --- /dev/null +++ b/src/test/java/org/apache/commons/lang3/time/FastDateParser_TimeZoneStrategyTest.java @@ -0,0 +1,44 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.commons.lang3.time; + +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + +import java.text.DateFormatSymbols; +import java.util.Locale; +import java.util.regex.Pattern; + +import org.junit.Test; + +public class FastDateParser_TimeZoneStrategyTest { + + @Test + public void testTimeZoneStrategyPattern() { + Pattern tz = Pattern.compile(FastDateParser.TimeZoneStrategy.TZ_DATABASE); + assertFalse(tz.matcher("GMT-1234").matches()); + + for (Locale locale : Locale.getAvailableLocales()) { + final String[][] zones = DateFormatSymbols.getInstance(locale).getZoneStrings(); + for (final String[] zone : zones) { + for (String zoneExpr : zone) { + assertTrue(locale.getDisplayName() + ":" + zoneExpr, tz.matcher(zoneExpr).matches()); + } + } + } + } +}