From 967fdd064c6d67774204d1b2e93301435f4d6a64 Mon Sep 17 00:00:00 2001 From: Benedikt Ritter Date: Sat, 12 Jul 2014 11:01:37 +0000 Subject: [PATCH] LANG-1024: Fix JavaDoc errors in test code git-svn-id: https://svn.apache.org/repos/asf/commons/proper/lang/trunk@1609902 13f79535-47bb-0310-9956-ffa450edef68 --- src/site/xdoc/index.xml | 4 -- .../apache/commons/lang3/ObjectUtilsTest.java | 4 ++ .../commons/lang3/RandomStringUtilsTest.java | 11 ++-- .../apache/commons/lang3/RandomUtilsTest.java | 28 +++++----- .../commons/lang3/StringEscapeUtilsTest.java | 7 ++- .../apache/commons/lang3/StringUtilsTest.java | 24 ++++----- .../lang3/builder/ToStringBuilderTest.java | 25 +++------ .../AbstractConcurrentInitializerTest.java | 7 +++ .../concurrent/AtomicSafeInitializerTest.java | 3 ++ .../concurrent/BackgroundInitializerTest.java | 16 ++++-- .../CallableBackgroundInitializerTest.java | 2 + .../lang3/concurrent/ConcurrentUtilsTest.java | 28 ++++++++++ .../concurrent/ConstantInitializerTest.java | 2 + .../MultiBackgroundInitializerTest.java | 30 +++++++++++ .../lang3/concurrent/TimedSemaphoreTest.java | 22 ++++++++ .../lang3/time/DateUtilsRoundingTest.java | 52 +++++++++---------- .../commons/lang3/time/DateUtilsTest.java | 16 ++++++ .../lang3/time/DurationFormatUtilsTest.java | 2 +- .../lang3/time/FastDateFormatTest.java | 2 +- .../lang3/time/FastDateParserTest.java | 13 +++-- .../lang3/time/FastDatePrinterTest.java | 8 +-- 21 files changed, 206 insertions(+), 100 deletions(-) diff --git a/src/site/xdoc/index.xml b/src/site/xdoc/index.xml index ddae2e098..29a365554 100644 --- a/src/site/xdoc/index.xml +++ b/src/site/xdoc/index.xml @@ -71,10 +71,6 @@ The code base is monitored by a Sonar instance running on 2.x to 3.0 upgrade notes
  • Compare major versions via the Lang2 to Lang3 Clirr report
  • -

    Special note on 3.3.2 and Java 8: Due to the addition of DocLint -to the JavaDoc tool mvn site will currently fail because the test code contains malformed JavaDoc comments. -If you want to build the site yourself use Java 6 or Java 7 or deactivate DocLint by configuring the Maven JavaDoc with -<additionalparam>-Xdoclint:none</additionalparam>.

    Alternatively you can pull it from the central Maven repositories:

    diff --git a/src/test/java/org/apache/commons/lang3/ObjectUtilsTest.java b/src/test/java/org/apache/commons/lang3/ObjectUtilsTest.java
    index 523cde26c..4d48e5af4 100644
    --- a/src/test/java/org/apache/commons/lang3/ObjectUtilsTest.java
    +++ b/src/test/java/org/apache/commons/lang3/ObjectUtilsTest.java
    @@ -468,6 +468,8 @@ public class ObjectUtilsTest {
     
         /**
          * Tests {@link ObjectUtils#clone(Object)} with an uncloneable object.
    +     *
    +     * @throws java.lang.Throwable because we expect this to fail
          */
         @Test(expected = NoSuchMethodException.class)
         public void testCloneOfUncloneable() throws Throwable {
    @@ -518,6 +520,8 @@ public class ObjectUtilsTest {
     
         /**
          * Tests {@link ObjectUtils#cloneIfPossible(Object)} with an uncloneable object.
    +     *
    +     * @throws java.lang.Throwable because we expect this to fail
          */
         @Test(expected = NoSuchMethodException.class)
         public void testPossibleCloneOfUncloneable() throws Throwable {
    diff --git a/src/test/java/org/apache/commons/lang3/RandomStringUtilsTest.java b/src/test/java/org/apache/commons/lang3/RandomStringUtilsTest.java
    index 420d7bb69..f9fcd0336 100644
    --- a/src/test/java/org/apache/commons/lang3/RandomStringUtilsTest.java
    +++ b/src/test/java/org/apache/commons/lang3/RandomStringUtilsTest.java
    @@ -24,6 +24,7 @@ import static org.junit.Assert.fail;
     
     import java.lang.reflect.Constructor;
     import java.lang.reflect.Modifier;
    +import java.nio.charset.Charset;
     import java.util.Random;
     
     import org.junit.Test;
    @@ -334,16 +335,14 @@ public class RandomStringUtilsTest {
          * can be converted to UTF-8 and back without loss.
          *
          * @see LANG-100
    -     *
    -     * @throws Exception
          */
         @Test
    -    public void testLang100() throws Exception {
    +    public void testLang100() {
             final int size = 5000;
    -        final String encoding = "UTF-8";
    +        final Charset charset = Charset.forName("UTF-8");
             final String orig = RandomStringUtils.random(size);
    -        final byte[] bytes = orig.getBytes(encoding);
    -        final String copy = new String(bytes, encoding);
    +        final byte[] bytes = orig.getBytes(charset);
    +        final String copy = new String(bytes, charset);
     
             // for a verbose compare:
             for (int i=0; i < orig.length() && i < copy.length(); i++) {
    diff --git a/src/test/java/org/apache/commons/lang3/RandomUtilsTest.java b/src/test/java/org/apache/commons/lang3/RandomUtilsTest.java
    index 4a0eadc6e..f1080c948 100644
    --- a/src/test/java/org/apache/commons/lang3/RandomUtilsTest.java
    +++ b/src/test/java/org/apache/commons/lang3/RandomUtilsTest.java
    @@ -84,7 +84,7 @@ public class RandomUtilsTest {
          * Tests a zero byte array length.
          */
         @Test
    -    public void testZeroLengthNextBytes() throws Exception {
    +    public void testZeroLengthNextBytes() {
             assertArrayEquals(new byte[0], RandomUtils.nextBytes(0));
         }
     
    @@ -92,7 +92,7 @@ public class RandomUtilsTest {
          * Tests random byte array.
          */
         @Test
    -    public void testNextBytes() throws Exception {
    +    public void testNextBytes() {
             final byte[] result = RandomUtils.nextBytes(20);
             assertEquals(20, result.length);
         }
    @@ -101,7 +101,7 @@ public class RandomUtilsTest {
          * Test next int range with minimal range.
          */
         @Test
    -    public void testNextIntMinimalRange() throws Exception {
    +    public void testNextIntMinimalRange() {
             assertEquals(42, RandomUtils.nextInt(42, 42));
         }
         
    @@ -109,7 +109,7 @@ public class RandomUtilsTest {
          * Tests next int range.
          */
         @Test
    -    public void testNextInt() throws Exception {
    +    public void testNextInt() {
             final int result = RandomUtils.nextInt(33, 42);
             assertTrue(result >= 33 && result < 42);
         }
    @@ -118,7 +118,7 @@ public class RandomUtilsTest {
          * Test next double range with minimal range.
          */
         @Test
    -    public void testNextDoubleMinimalRange() throws Exception {
    +    public void testNextDoubleMinimalRange() {
             assertEquals(42.1, RandomUtils.nextDouble(42.1, 42.1), DELTA);
         }    
         
    @@ -126,7 +126,7 @@ public class RandomUtilsTest {
          * Test next float range with minimal range.
          */
         @Test
    -    public void testNextFloatMinimalRange() throws Exception {
    +    public void testNextFloatMinimalRange() {
             assertEquals(42.1f, RandomUtils.nextFloat(42.1f, 42.1f), DELTA);
         }     
         
    @@ -134,7 +134,7 @@ public class RandomUtilsTest {
          * Tests next double range.
          */
         @Test
    -    public void testNextDouble() throws Exception {
    +    public void testNextDouble() {
             final double result = RandomUtils.nextDouble(33d, 42d);
             assertTrue(result >= 33d && result <= 42d);
         }
    @@ -143,7 +143,7 @@ public class RandomUtilsTest {
          * Tests next float range.
          */
         @Test
    -    public void testNextFloat() throws Exception {
    +    public void testNextFloat() {
             final double result = RandomUtils.nextFloat(33f, 42f);
             assertTrue(result >= 33f && result <= 42f);
         }    
    @@ -152,7 +152,7 @@ public class RandomUtilsTest {
          * Test next long range with minimal range.
          */
         @Test
    -    public void testNextLongMinimalRange() throws Exception {
    +    public void testNextLongMinimalRange() {
             assertEquals(42L, RandomUtils.nextLong(42L, 42L));
         }
         
    @@ -160,7 +160,7 @@ public class RandomUtilsTest {
          * Tests next long range.
          */
         @Test
    -    public void testNextLong() throws Exception {
    +    public void testNextLong() {
             final long result = RandomUtils.nextLong(33L, 42L);
             assertTrue(result >= 33L && result < 42L);
         }
    @@ -170,7 +170,7 @@ public class RandomUtilsTest {
          * Tests extreme range.
          */
         @Test
    -    public void testExtremeRangeInt() throws Exception {
    +    public void testExtremeRangeInt() {
             final int result = RandomUtils.nextInt(0, Integer.MAX_VALUE);
             assertTrue(result >= 0 && result < Integer.MAX_VALUE);
         }
    @@ -179,7 +179,7 @@ public class RandomUtilsTest {
          * Tests extreme range.
          */
         @Test
    -    public void testExtremeRangeLong() throws Exception {
    +    public void testExtremeRangeLong() {
             final long result = RandomUtils.nextLong(0, Long.MAX_VALUE);
             assertTrue(result >= 0 && result < Long.MAX_VALUE);
         }    
    @@ -188,7 +188,7 @@ public class RandomUtilsTest {
          * Tests extreme range.
          */
         @Test
    -    public void testExtremeRangeFloat() throws Exception {
    +    public void testExtremeRangeFloat() {
             final float result = RandomUtils.nextFloat(0, Float.MAX_VALUE);
             assertTrue(result >= 0f && result <= Float.MAX_VALUE);
         }    
    @@ -197,7 +197,7 @@ public class RandomUtilsTest {
          * Tests extreme range.
          */
         @Test
    -    public void testExtremeRangeDouble() throws Exception {
    +    public void testExtremeRangeDouble() {
             final double result = RandomUtils.nextDouble(0, Double.MAX_VALUE);
             assertTrue(result >= 0 && result <= Double.MAX_VALUE);
         }    
    diff --git a/src/test/java/org/apache/commons/lang3/StringEscapeUtilsTest.java b/src/test/java/org/apache/commons/lang3/StringEscapeUtilsTest.java
    index c75ce4063..1e31309eb 100644
    --- a/src/test/java/org/apache/commons/lang3/StringEscapeUtilsTest.java
    +++ b/src/test/java/org/apache/commons/lang3/StringEscapeUtilsTest.java
    @@ -27,6 +27,7 @@ import java.io.IOException;
     import java.io.StringWriter;
     import java.lang.reflect.Constructor;
     import java.lang.reflect.Modifier;
    +import java.nio.charset.Charset;
     
     import org.apache.commons.io.IOUtils;
     import org.apache.commons.lang3.text.translate.CharSequenceTranslator;
    @@ -510,18 +511,16 @@ public class StringEscapeUtilsTest {
     
         /**
          * Tests // https://issues.apache.org/jira/browse/LANG-480
    -     * 
    -     * @throws java.io.UnsupportedEncodingException
          */
         @Test
    -    public void testEscapeHtmlHighUnicode() throws java.io.UnsupportedEncodingException {
    +    public void testEscapeHtmlHighUnicode() {
             // this is the utf8 representation of the character:
             // COUNTING ROD UNIT DIGIT THREE
             // in Unicode
             // codepoint: U+1D362
             final byte[] data = new byte[] { (byte)0xF0, (byte)0x9D, (byte)0x8D, (byte)0xA2 };
     
    -        final String original = new String(data, "UTF8");
    +        final String original = new String(data, Charset.forName("UTF8"));
     
             final String escaped = StringEscapeUtils.escapeHtml4( original );
             assertEquals( "High Unicode should not have been escaped", original, escaped);
    diff --git a/src/test/java/org/apache/commons/lang3/StringUtilsTest.java b/src/test/java/org/apache/commons/lang3/StringUtilsTest.java
    index 33b4634a3..e9931ffc4 100644
    --- a/src/test/java/org/apache/commons/lang3/StringUtilsTest.java
    +++ b/src/test/java/org/apache/commons/lang3/StringUtilsTest.java
    @@ -2316,22 +2316,21 @@ public class StringUtilsTest {
     
         /**
          * Tests {@link StringUtils#toString(byte[], String)}
    -     * 
    -     * @throws UnsupportedEncodingException
    +     *
    +     * @throws java.io.UnsupportedEncodingException because the method under test max throw it
          * @see StringUtils#toString(byte[], String)
          */
         @Test
         public void testToString() throws UnsupportedEncodingException {
             final String expectedString = "The quick brown fox jumped over the lazy dog.";
    -        String encoding = SystemUtils.FILE_ENCODING;
    -        byte[] expectedBytes = expectedString.getBytes(encoding);
    +        byte[] expectedBytes = expectedString.getBytes(Charset.defaultCharset());
             // sanity check start
             assertArrayEquals(expectedBytes, expectedString.getBytes());
             // sanity check end
             assertEquals(expectedString, StringUtils.toString(expectedBytes, null));
    -        assertEquals(expectedString, StringUtils.toString(expectedBytes, encoding));
    -        encoding = "UTF-16";
    -        expectedBytes = expectedString.getBytes(encoding);
    +        assertEquals(expectedString, StringUtils.toString(expectedBytes, SystemUtils.FILE_ENCODING));
    +        String encoding = "UTF-16";
    +        expectedBytes = expectedString.getBytes(Charset.forName(encoding));
             assertEquals(expectedString, StringUtils.toString(expectedBytes, encoding));
         }
         
    @@ -2349,11 +2348,9 @@ public class StringUtilsTest {
         
         /**
          * Tests LANG-858.
    -     * 
    -     * @throws Exception
          */
         @Test
    -    public void testEscapeSurrogatePairsLang858() throws Exception {
    +    public void testEscapeSurrogatePairsLang858() {
             assertEquals("\\uDBFF\\uDFFD", StringEscapeUtils.escapeJava("\uDBFF\uDFFD"));       //fail LANG-858
             assertEquals("\\uDBFF\\uDFFD", StringEscapeUtils.escapeEcmaScript("\uDBFF\uDFFD")); //fail LANG-858
         }
    @@ -2468,21 +2465,20 @@ public class StringUtilsTest {
         /**
          * Tests {@link StringUtils#toEncodedString(byte[], Charset)}
          * 
    -     * @throws UnsupportedEncodingException
          * @see StringUtils#toEncodedString(byte[], Charset)
          */
         @Test
    -    public void testToEncodedString() throws UnsupportedEncodingException {
    +    public void testToEncodedString() {
             final String expectedString = "The quick brown fox jumped over the lazy dog.";
             String encoding = SystemUtils.FILE_ENCODING;
    -        byte[] expectedBytes = expectedString.getBytes(encoding);
    +        byte[] expectedBytes = expectedString.getBytes(Charset.defaultCharset());
             // sanity check start
             assertArrayEquals(expectedBytes, expectedString.getBytes());
             // sanity check end
             assertEquals(expectedString, StringUtils.toEncodedString(expectedBytes, Charset.defaultCharset()));
             assertEquals(expectedString, StringUtils.toEncodedString(expectedBytes, Charset.forName(encoding)));
             encoding = "UTF-16";
    -        expectedBytes = expectedString.getBytes(encoding);
    +        expectedBytes = expectedString.getBytes(Charset.forName(encoding));
             assertEquals(expectedString, StringUtils.toEncodedString(expectedBytes, Charset.forName(encoding)));
         }
         
    diff --git a/src/test/java/org/apache/commons/lang3/builder/ToStringBuilderTest.java b/src/test/java/org/apache/commons/lang3/builder/ToStringBuilderTest.java
    index b28ed166e..d52dd5266 100644
    --- a/src/test/java/org/apache/commons/lang3/builder/ToStringBuilderTest.java
    +++ b/src/test/java/org/apache/commons/lang3/builder/ToStringBuilderTest.java
    @@ -396,7 +396,7 @@ public class ToStringBuilderTest {
          * Test an array element pointing to its container.
          */
         @Test
    -    public void testReflectionArrayCycle() throws Exception {
    +    public void testReflectionArrayCycle() {
             final Object[] objects = new Object[1];
             objects[0] = objects;
             assertEquals(
    @@ -408,7 +408,7 @@ public class ToStringBuilderTest {
          * Test an array element pointing to its container.
          */
         @Test
    -    public void testReflectionArrayCycleLevel2() throws Exception {
    +    public void testReflectionArrayCycleLevel2() {
             final Object[] objects = new Object[1];
             final Object[] objectsLevel2 = new Object[1];
             objects[0] = objectsLevel2;
    @@ -522,11 +522,9 @@ public class ToStringBuilderTest {
     
         /**
          * Test an Object pointing to itself, the simplest test.
    -     *
    -     * @throws Exception
          */
         @Test
    -    public void testSimpleReflectionObjectCycle() throws Exception {
    +    public void testSimpleReflectionObjectCycle() {
             final SimpleReflectionTestFixture simple = new SimpleReflectionTestFixture();
             simple.o = simple;
             assertEquals(this.toBaseString(simple) + "[o=" + this.toBaseString(simple) + "]", simple.toString());
    @@ -534,11 +532,9 @@ public class ToStringBuilderTest {
     
         /**
          * Test a class that defines an ivar pointing to itself.
    -     *
    -     * @throws Exception
          */
         @Test
    -    public void testSelfInstanceVarReflectionObjectCycle() throws Exception {
    +    public void testSelfInstanceVarReflectionObjectCycle() {
             final SelfInstanceVarReflectionTestFixture test = new SelfInstanceVarReflectionTestFixture();
             assertEquals(this.toBaseString(test) + "[typeIsSelf=" + this.toBaseString(test) + "]", test.toString());
         }
    @@ -546,11 +542,9 @@ public class ToStringBuilderTest {
         /**
          * Test a class that defines an ivar pointing to itself.  This test was
          * created to show that handling cyclical object resulted in a missing endFieldSeparator call.
    -     *
    -     * @throws Exception
          */
         @Test
    -    public void testSelfInstanceTwoVarsReflectionObjectCycle() throws Exception {
    +    public void testSelfInstanceTwoVarsReflectionObjectCycle() {
             final SelfInstanceTwoVarsReflectionTestFixture test = new SelfInstanceTwoVarsReflectionTestFixture();
             assertEquals(this.toBaseString(test) + "[typeIsSelf=" + this.toBaseString(test) + ",otherType=" + test.getOtherType().toString() + "]", test.toString());
         }
    @@ -558,11 +552,9 @@ public class ToStringBuilderTest {
     
         /**
          * Test Objects pointing to each other.
    -     *
    -     * @throws Exception
          */
         @Test
    -    public void testReflectionObjectCycle() throws Exception {
    +    public void testReflectionObjectCycle() {
             final ReflectionTestCycleA a = new ReflectionTestCycleA();
             final ReflectionTestCycleB b = new ReflectionTestCycleB();
             a.b = b;
    @@ -575,11 +567,9 @@ public class ToStringBuilderTest {
         /**
          * Test a nasty combination of arrays and Objects pointing to each other.
          * objects[0] -> SimpleReflectionTestFixture[ o -> objects ]
    -     *
    -     * @throws Exception
          */
         @Test
    -    public void testReflectionArrayAndObjectCycle() throws Exception {
    +    public void testReflectionArrayAndObjectCycle() {
             final Object[] objects = new Object[1];
             final SimpleReflectionTestFixture simple = new SimpleReflectionTestFixture(objects);
             objects[0] = simple;
    @@ -985,6 +975,7 @@ public class ToStringBuilderTest {
          * 

    If the style is null, the default * ToStringStyle is used.

    * + * @param the type of the output object * @param object the Object to be output * @param style the style of the toString to create, * may be null diff --git a/src/test/java/org/apache/commons/lang3/concurrent/AbstractConcurrentInitializerTest.java b/src/test/java/org/apache/commons/lang3/concurrent/AbstractConcurrentInitializerTest.java index 4744e5904..6bd8204af 100644 --- a/src/test/java/org/apache/commons/lang3/concurrent/AbstractConcurrentInitializerTest.java +++ b/src/test/java/org/apache/commons/lang3/concurrent/AbstractConcurrentInitializerTest.java @@ -39,6 +39,8 @@ import org.junit.Test; public abstract class AbstractConcurrentInitializerTest { /** * Tests a simple invocation of the get() method. + * + * @throws org.apache.commons.lang3.concurrent.ConcurrentException because the object under test may throw it */ @Test public void testGet() throws ConcurrentException { @@ -48,6 +50,8 @@ public abstract class AbstractConcurrentInitializerTest { /** * Tests whether sequential get() invocations always return the same * instance. + * + * @throws org.apache.commons.lang3.concurrent.ConcurrentException because the object under test may throw it */ @Test public void testGetMultipleTimes() throws ConcurrentException { @@ -61,6 +65,9 @@ public abstract class AbstractConcurrentInitializerTest { /** * Tests whether get() can be invoked from multiple threads concurrently. * Always the same object should be returned. + * + * @throws org.apache.commons.lang3.concurrent.ConcurrentException because the object under test may throw it + * @throws java.lang.InterruptedException because the threading API my throw it */ @Test public void testGetConcurrent() throws ConcurrentException, diff --git a/src/test/java/org/apache/commons/lang3/concurrent/AtomicSafeInitializerTest.java b/src/test/java/org/apache/commons/lang3/concurrent/AtomicSafeInitializerTest.java index 0deb71351..bcf1688cb 100644 --- a/src/test/java/org/apache/commons/lang3/concurrent/AtomicSafeInitializerTest.java +++ b/src/test/java/org/apache/commons/lang3/concurrent/AtomicSafeInitializerTest.java @@ -50,6 +50,9 @@ public class AtomicSafeInitializerTest extends /** * Tests that initialize() is called only once. + * + * @throws org.apache.commons.lang3.concurrent.ConcurrentException because {@link #testGetConcurrent()} may throw it + * @throws java.lang.InterruptedException because {@link #testGetConcurrent()} may throw it */ @Test public void testNumberOfInitializeInvocations() throws ConcurrentException, diff --git a/src/test/java/org/apache/commons/lang3/concurrent/BackgroundInitializerTest.java b/src/test/java/org/apache/commons/lang3/concurrent/BackgroundInitializerTest.java index e8a6e5ed5..492df4aa3 100644 --- a/src/test/java/org/apache/commons/lang3/concurrent/BackgroundInitializerTest.java +++ b/src/test/java/org/apache/commons/lang3/concurrent/BackgroundInitializerTest.java @@ -108,7 +108,7 @@ public class BackgroundInitializerTest { * setExternalExecutor() method. */ @Test - public void testSetExternalExecutor() throws Exception { + public void testSetExternalExecutor() { final ExecutorService exec = Executors.newCachedThreadPool(); try { final BackgroundInitializerTestImpl init = new BackgroundInitializerTestImpl(); @@ -126,6 +126,8 @@ public class BackgroundInitializerTest { /** * Tests that setting an executor after start() causes an exception. + * + * @throws org.apache.commons.lang3.concurrent.ConcurrentException because the test implementation may throw it */ @Test public void testSetExternalExecutorAfterStart() throws ConcurrentException { @@ -155,6 +157,8 @@ public class BackgroundInitializerTest { /** * Tests calling get() before start(). This should cause an exception. + * + * @throws org.apache.commons.lang3.concurrent.ConcurrentException because the test implementation may throw it */ @Test(expected=IllegalStateException.class) public void testGetBeforeStart() throws ConcurrentException { @@ -167,7 +171,7 @@ public class BackgroundInitializerTest { * exception. */ @Test - public void testGetRuntimeException() throws Exception { + public void testGetRuntimeException() { final BackgroundInitializerTestImpl init = new BackgroundInitializerTestImpl(); final RuntimeException rex = new RuntimeException(); init.ex = rex; @@ -185,7 +189,7 @@ public class BackgroundInitializerTest { * exception. */ @Test - public void testGetCheckedException() throws Exception { + public void testGetCheckedException() { final BackgroundInitializerTestImpl init = new BackgroundInitializerTestImpl(); final Exception ex = new Exception(); init.ex = ex; @@ -200,9 +204,11 @@ public class BackgroundInitializerTest { /** * Tests the get() method if waiting for the initialization is interrupted. + * + * @throws java.lang.InterruptedException because we're making use of Java's concurrent API */ @Test - public void testGetInterruptedException() throws Exception { + public void testGetInterruptedException() throws InterruptedException { final ExecutorService exec = Executors.newSingleThreadExecutor(); final BackgroundInitializerTestImpl init = new BackgroundInitializerTestImpl( exec); @@ -289,6 +295,8 @@ public class BackgroundInitializerTest { /** * Records this invocation. Optionally throws an exception or sleeps a * while. + * + * @throws Exception in case of an error */ @Override protected Integer initialize() throws Exception { diff --git a/src/test/java/org/apache/commons/lang3/concurrent/CallableBackgroundInitializerTest.java b/src/test/java/org/apache/commons/lang3/concurrent/CallableBackgroundInitializerTest.java index 3e966c273..b9028db66 100644 --- a/src/test/java/org/apache/commons/lang3/concurrent/CallableBackgroundInitializerTest.java +++ b/src/test/java/org/apache/commons/lang3/concurrent/CallableBackgroundInitializerTest.java @@ -66,6 +66,8 @@ public class CallableBackgroundInitializerTest { /** * Tests the implementation of initialize(). + * + * @throws java.lang.Exception so we don't have to catch it */ @Test public void testInitialize() throws Exception { diff --git a/src/test/java/org/apache/commons/lang3/concurrent/ConcurrentUtilsTest.java b/src/test/java/org/apache/commons/lang3/concurrent/ConcurrentUtilsTest.java index 602573128..d23d95475 100644 --- a/src/test/java/org/apache/commons/lang3/concurrent/ConcurrentUtilsTest.java +++ b/src/test/java/org/apache/commons/lang3/concurrent/ConcurrentUtilsTest.java @@ -200,6 +200,8 @@ public class ConcurrentUtilsTest { /** * Tests handleCause() if the cause is an error. + * + * @throws org.apache.commons.lang3.concurrent.ConcurrentException so we don't have to catch it */ @Test public void testHandleCauseError() throws ConcurrentException { @@ -214,6 +216,8 @@ public class ConcurrentUtilsTest { /** * Tests handleCause() if the cause is an unchecked exception. + * + * @throws org.apache.commons.lang3.concurrent.ConcurrentException so we don't have to catch it */ @Test public void testHandleCauseUncheckedException() throws ConcurrentException { @@ -244,6 +248,8 @@ public class ConcurrentUtilsTest { * Tests handleCause() for a null parameter or a null cause. In this case * the method should do nothing. We can only test that no exception is * thrown. + * + * @throws org.apache.commons.lang3.concurrent.ConcurrentException so we don't have to catch it */ @Test public void testHandleCauseNull() throws ConcurrentException { @@ -308,6 +314,8 @@ public class ConcurrentUtilsTest { //----------------------------------------------------------------------- /** * Tests initialize() for a null argument. + * + * @throws org.apache.commons.lang3.concurrent.ConcurrentException so we don't have to catch it */ @Test public void testInitializeNull() throws ConcurrentException { @@ -316,6 +324,8 @@ public class ConcurrentUtilsTest { /** * Tests a successful initialize() operation. + * + * @throws org.apache.commons.lang3.concurrent.ConcurrentException so we don't have to catch it */ @Test public void testInitialize() throws ConcurrentException { @@ -341,6 +351,8 @@ public class ConcurrentUtilsTest { /** * Tests a successful initializeUnchecked() operation. + * + * @throws org.apache.commons.lang3.concurrent.ConcurrentException so we don't have to catch it */ @Test public void testInitializeUnchecked() throws ConcurrentException { @@ -358,6 +370,8 @@ public class ConcurrentUtilsTest { /** * Tests whether exceptions are correctly handled by initializeUnchecked(). + * + * @throws org.apache.commons.lang3.concurrent.ConcurrentException so we don't have to catch it */ @Test public void testInitializeUncheckedEx() throws ConcurrentException { @@ -380,6 +394,8 @@ public class ConcurrentUtilsTest { //----------------------------------------------------------------------- /** * Tests constant future. + * + * @throws java.lang.Exception so we don't have to catch it */ @Test public void testConstantFuture_Integer() throws Exception { @@ -396,6 +412,8 @@ public class ConcurrentUtilsTest { /** * Tests constant future. + * + * @throws java.lang.Exception so we don't have to catch it */ @Test public void testConstantFuture_null() throws Exception { @@ -449,6 +467,8 @@ public class ConcurrentUtilsTest { /** * Tests createIfAbsent() if the key is found in the map. + * + * @throws org.apache.commons.lang3.concurrent.ConcurrentException so we don't have to catch it */ @Test public void testCreateIfAbsentKeyPresent() throws ConcurrentException { @@ -469,6 +489,8 @@ public class ConcurrentUtilsTest { /** * Tests createIfAbsent() if the map does not contain the key in question. + * + * @throws org.apache.commons.lang3.concurrent.ConcurrentException so we don't have to catch it */ @Test public void testCreateIfAbsentKeyNotPresent() throws ConcurrentException { @@ -489,6 +511,8 @@ public class ConcurrentUtilsTest { /** * Tests createIfAbsent() if a null map is passed in. + * + * @throws org.apache.commons.lang3.concurrent.ConcurrentException so we don't have to catch it */ @Test public void testCreateIfAbsentNullMap() throws ConcurrentException { @@ -504,6 +528,8 @@ public class ConcurrentUtilsTest { /** * Tests createIfAbsent() if a null initializer is passed in. + * + * @throws org.apache.commons.lang3.concurrent.ConcurrentException so we don't have to catch it */ @Test public void testCreateIfAbsentNullInit() throws ConcurrentException { @@ -532,6 +558,8 @@ public class ConcurrentUtilsTest { /** * Tests createIfAbsentUnchecked() if an exception is thrown. + * + * @throws org.apache.commons.lang3.concurrent.ConcurrentException so we don't have to catch it */ @Test public void testCreateIfAbsentUncheckedException() diff --git a/src/test/java/org/apache/commons/lang3/concurrent/ConstantInitializerTest.java b/src/test/java/org/apache/commons/lang3/concurrent/ConstantInitializerTest.java index ec9c19d0e..446089c19 100644 --- a/src/test/java/org/apache/commons/lang3/concurrent/ConstantInitializerTest.java +++ b/src/test/java/org/apache/commons/lang3/concurrent/ConstantInitializerTest.java @@ -68,6 +68,8 @@ public class ConstantInitializerTest { /** * Tests whether get() returns the correct object. + * + * @throws org.apache.commons.lang3.concurrent.ConcurrentException so we don't have to catch it */ @Test public void testGet() throws ConcurrentException { diff --git a/src/test/java/org/apache/commons/lang3/concurrent/MultiBackgroundInitializerTest.java b/src/test/java/org/apache/commons/lang3/concurrent/MultiBackgroundInitializerTest.java index 40009d3ac..c22f9f783 100644 --- a/src/test/java/org/apache/commons/lang3/concurrent/MultiBackgroundInitializerTest.java +++ b/src/test/java/org/apache/commons/lang3/concurrent/MultiBackgroundInitializerTest.java @@ -88,6 +88,8 @@ public class MultiBackgroundInitializerTest { /** * Tests the background processing if there are no child initializers. + * + * @throws org.apache.commons.lang3.concurrent.ConcurrentException so we don't have to catch it */ @Test public void testInitializeNoChildren() throws ConcurrentException { @@ -104,6 +106,8 @@ public class MultiBackgroundInitializerTest { * operate with both an external and a temporary executor service. * * @return the result object produced by the initializer + * + * @throws org.apache.commons.lang3.concurrent.ConcurrentException so we don't have to catch it */ private MultiBackgroundInitializer.MultiBackgroundInitializerResults checkInitialize() throws ConcurrentException { @@ -132,6 +136,8 @@ public class MultiBackgroundInitializerTest { /** * Tests background processing if a temporary executor is used. + * + * @throws org.apache.commons.lang3.concurrent.ConcurrentException so we don't have to catch it */ @Test public void testInitializeTempExec() throws ConcurrentException { @@ -142,6 +148,8 @@ public class MultiBackgroundInitializerTest { /** * Tests background processing if an external executor service is provided. + * + * @throws org.apache.commons.lang3.concurrent.ConcurrentException so we don't have to catch it */ @Test public void testInitializeExternalExec() throws ConcurrentException { @@ -160,6 +168,8 @@ public class MultiBackgroundInitializerTest { /** * Tests the behavior of initialize() if a child initializer has a specific * executor service. Then this service should not be overridden. + * + * @throws org.apache.commons.lang3.concurrent.ConcurrentException so we don't have to catch it */ @Test public void testInitializeChildWithExecutor() throws ConcurrentException { @@ -183,6 +193,8 @@ public class MultiBackgroundInitializerTest { /** * Tries to add another child initializer after the start() method has been * called. This should not be allowed. + * + * @throws org.apache.commons.lang3.concurrent.ConcurrentException so we don't have to catch it */ @Test public void testAddInitializerAfterStart() throws ConcurrentException { @@ -199,6 +211,8 @@ public class MultiBackgroundInitializerTest { /** * Tries to query an unknown child initializer from the results object. This * should cause an exception. + * + * @throws org.apache.commons.lang3.concurrent.ConcurrentException so we don't have to catch it */ @Test(expected = NoSuchElementException.class) public void testResultGetInitializerUnknown() throws ConcurrentException { @@ -209,6 +223,8 @@ public class MultiBackgroundInitializerTest { /** * Tries to query the results of an unknown child initializer from the * results object. This should cause an exception. + * + * @throws org.apache.commons.lang3.concurrent.ConcurrentException so we don't have to catch it */ @Test(expected = NoSuchElementException.class) public void testResultGetResultObjectUnknown() throws ConcurrentException { @@ -219,6 +235,8 @@ public class MultiBackgroundInitializerTest { /** * Tries to query the exception of an unknown child initializer from the * results object. This should cause an exception. + * + * @throws org.apache.commons.lang3.concurrent.ConcurrentException so we don't have to catch it */ @Test(expected = NoSuchElementException.class) public void testResultGetExceptionUnknown() throws ConcurrentException { @@ -229,6 +247,8 @@ public class MultiBackgroundInitializerTest { /** * Tries to query the exception flag of an unknown child initializer from * the results object. This should cause an exception. + * + * @throws org.apache.commons.lang3.concurrent.ConcurrentException so we don't have to catch it */ @Test(expected = NoSuchElementException.class) public void testResultIsExceptionUnknown() throws ConcurrentException { @@ -238,6 +258,8 @@ public class MultiBackgroundInitializerTest { /** * Tests that the set with the names of the initializers cannot be modified. + * + * @throws org.apache.commons.lang3.concurrent.ConcurrentException so we don't have to catch it */ @Test(expected = UnsupportedOperationException.class) public void testResultInitializerNamesModify() throws ConcurrentException { @@ -270,6 +292,8 @@ public class MultiBackgroundInitializerTest { /** * Tests the behavior of the initializer if one of the child initializers * throws a checked exception. + * + * @throws org.apache.commons.lang3.concurrent.ConcurrentException so we don't have to catch it */ @Test public void testInitializeEx() throws ConcurrentException { @@ -288,6 +312,8 @@ public class MultiBackgroundInitializerTest { /** * Tests the isSuccessful() method of the result object if no child * initializer has thrown an exception. + * + * @throws org.apache.commons.lang3.concurrent.ConcurrentException so we don't have to catch it */ @Test public void testInitializeResultsIsSuccessfulTrue() @@ -303,6 +329,8 @@ public class MultiBackgroundInitializerTest { /** * Tests the isSuccessful() method of the result object if at least one * child initializer has thrown an exception. + * + * @throws org.apache.commons.lang3.concurrent.ConcurrentException so we don't have to catch it */ @Test public void testInitializeResultsIsSuccessfulFalse() @@ -319,6 +347,8 @@ public class MultiBackgroundInitializerTest { /** * Tests whether MultiBackgroundInitializers can be combined in a nested * way. + * + * @throws org.apache.commons.lang3.concurrent.ConcurrentException so we don't have to catch it */ @Test public void testInitializeNested() throws ConcurrentException { diff --git a/src/test/java/org/apache/commons/lang3/concurrent/TimedSemaphoreTest.java b/src/test/java/org/apache/commons/lang3/concurrent/TimedSemaphoreTest.java index c9bd68b62..745c712bc 100644 --- a/src/test/java/org/apache/commons/lang3/concurrent/TimedSemaphoreTest.java +++ b/src/test/java/org/apache/commons/lang3/concurrent/TimedSemaphoreTest.java @@ -96,6 +96,8 @@ public class TimedSemaphoreTest { /** * Tests starting the timer. + * + * @throws java.lang.InterruptedException so we don't have to catch it */ @Test public void testStartTimer() throws InterruptedException { @@ -160,6 +162,8 @@ public class TimedSemaphoreTest { /** * Tests the shutdown() method for a shared executor after the task was * started. In this case the task must be canceled. + * + * @throws java.lang.InterruptedException so we don't have to catch it */ @Test public void testShutdownSharedExecutorTask() throws InterruptedException { @@ -179,6 +183,8 @@ public class TimedSemaphoreTest { /** * Tests multiple invocations of the shutdown() method. + * + * @throws java.lang.InterruptedException so we don't have to catch it */ @Test public void testShutdownMultipleTimes() throws InterruptedException { @@ -199,6 +205,8 @@ public class TimedSemaphoreTest { /** * Tests the acquire() method if a limit is set. + * + * @throws java.lang.InterruptedException so we don't have to catch it */ @Test public void testAcquireLimit() throws InterruptedException { @@ -236,6 +244,8 @@ public class TimedSemaphoreTest { * This method starts a number of threads that all invoke the semaphore. The * semaphore's limit is set to 1, so in each period only a single thread can * acquire the semaphore. + * + * @throws java.lang.InterruptedException so we don't have to catch it */ @Test public void testAcquireMultipleThreads() throws InterruptedException { @@ -271,6 +281,8 @@ public class TimedSemaphoreTest { * Tests the acquire() method if no limit is set. A test thread is started * that calls the semaphore a large number of times. Even if the semaphore's * period does not end, the thread should never block. + * + * @throws java.lang.InterruptedException so we don't have to catch it */ @Test public void testAcquireNoLimit() throws InterruptedException { @@ -291,6 +303,8 @@ public class TimedSemaphoreTest { /** * Tries to call acquire() after shutdown(). This should cause an exception. + * + * @throws java.lang.InterruptedException so we don't have to catch it */ @Test(expected = IllegalStateException.class) public void testPassAfterShutdown() throws InterruptedException { @@ -304,6 +318,8 @@ public class TimedSemaphoreTest { * period is set to a very short time. A background thread calls the * semaphore a large number of times. While it runs at last one end of a * period should be reached. + * + * @throws java.lang.InterruptedException so we don't have to catch it */ @Test public void testAcquireMultiplePeriods() throws InterruptedException { @@ -321,6 +337,8 @@ public class TimedSemaphoreTest { /** * Tests the methods for statistics. + * + * @throws java.lang.InterruptedException so we don't have to catch it */ @Test public void testGetAverageCallsPerPeriod() throws InterruptedException { @@ -345,6 +363,8 @@ public class TimedSemaphoreTest { /** * Tests whether the available non-blocking calls can be queried. + * + * @throws java.lang.InterruptedException so we don't have to catch it */ @Test public void testGetAvailablePermits() throws InterruptedException { @@ -403,6 +423,8 @@ public class TimedSemaphoreTest { /** * Invokes the latch if one is set. + * + * @throws java.lang.InterruptedException because it is declared that way in TimedSemaphore */ @Override public synchronized void acquire() throws InterruptedException { diff --git a/src/test/java/org/apache/commons/lang3/time/DateUtilsRoundingTest.java b/src/test/java/org/apache/commons/lang3/time/DateUtilsRoundingTest.java index 2a3b29d5b..29de105b1 100644 --- a/src/test/java/org/apache/commons/lang3/time/DateUtilsRoundingTest.java +++ b/src/test/java/org/apache/commons/lang3/time/DateUtilsRoundingTest.java @@ -78,7 +78,7 @@ public class DateUtilsRoundingTest { /** * Tests DateUtils.round()-method with Calendar.Year * - * @throws Exception + * @throws Exception so we don't have to catch it * @since 3.0 */ @Test @@ -95,7 +95,7 @@ public class DateUtilsRoundingTest { * Includes rounding months with 28, 29, 30 and 31 days * Includes rounding to January 1 * - * @throws Exception + * @throws Exception so we don't have to catch it * @since 3.0 */ @Test @@ -139,7 +139,7 @@ public class DateUtilsRoundingTest { * Includes rounding months with 28, 29, 30 and 31 days, each with first and second half * Includes rounding to January 1 * - * @throws Exception + * @throws Exception so we don't have to catch it * @since 3.0 */ @Test @@ -207,7 +207,7 @@ public class DateUtilsRoundingTest { * Includes rounding the extremes of one day * Includes rounding to January 1 * - * @throws Exception + * @throws Exception so we don't have to catch it * @since 3.0 */ @Test @@ -232,7 +232,7 @@ public class DateUtilsRoundingTest { * Includes rounding the extremes of one day * Includes rounding to January 1 * - * @throws Exception + * @throws Exception so we don't have to catch it * @since 3.0 */ @Test @@ -257,7 +257,7 @@ public class DateUtilsRoundingTest { * Includes rounding the extremes of both AM and PM of one day * Includes rounding to January 1 * - * @throws Exception + * @throws Exception so we don't have to catch it * @since 3.0 */ @Test @@ -289,7 +289,7 @@ public class DateUtilsRoundingTest { * Includes rounding the extremes of one hour * Includes rounding to January 1 * - * @throws Exception + * @throws Exception so we don't have to catch it * @since 3.0 */ @Test @@ -314,7 +314,7 @@ public class DateUtilsRoundingTest { * Includes rounding the extremes of one hour * Includes rounding to January 1 * - * @throws Exception + * @throws Exception so we don't have to catch it * @since 3.0 */ @Test @@ -339,7 +339,7 @@ public class DateUtilsRoundingTest { * Includes rounding the extremes of one minute * Includes rounding to January 1 * - * @throws Exception + * @throws Exception so we don't have to catch it * @since 3.0 */ @Test @@ -364,7 +364,7 @@ public class DateUtilsRoundingTest { * Includes rounding the extremes of one second * Includes rounding to January 1 * - * @throws Exception + * @throws Exception so we don't have to catch it * @since 3.0 */ @Test @@ -389,7 +389,7 @@ public class DateUtilsRoundingTest { * Includes rounding the extremes of one second * Includes rounding to January 1 * - * @throws Exception + * @throws Exception so we don't have to catch it * @since 3.0 */ @Test @@ -410,7 +410,7 @@ public class DateUtilsRoundingTest { /** * Test DateUtils.truncate()-method with Calendar.YEAR * - * @throws Exception + * @throws Exception so we don't have to catch it * @since 3.0 */ @Test @@ -423,7 +423,7 @@ public class DateUtilsRoundingTest { /** * Test DateUtils.truncate()-method with Calendar.MONTH * - * @throws Exception + * @throws Exception so we don't have to catch it * @since 3.0 */ @Test @@ -438,7 +438,7 @@ public class DateUtilsRoundingTest { * Test DateUtils.truncate()-method with DateUtils.SEMI_MONTH * Includes truncating months with 28, 29, 30 and 31 days, each with first and second half * - * @throws Exception + * @throws Exception so we don't have to catch it * @since 3.0 */ @Test @@ -491,7 +491,7 @@ public class DateUtilsRoundingTest { /** * Test DateUtils.truncate()-method with Calendar.DATE * - * @throws Exception + * @throws Exception so we don't have to catch it * @since 3.0 */ @Test @@ -504,7 +504,7 @@ public class DateUtilsRoundingTest { /** * Test DateUtils.truncate()-method with Calendar.DAY_OF_MONTH * - * @throws Exception + * @throws Exception so we don't have to catch it * @since 3.0 */ @Test @@ -518,7 +518,7 @@ public class DateUtilsRoundingTest { * Test DateUtils.truncate()-method with Calendar.AM_PM * Includes truncating the extremes of both AM and PM of one day * - * @throws Exception + * @throws Exception so we don't have to catch it * @since 3.0 */ @Test @@ -537,7 +537,7 @@ public class DateUtilsRoundingTest { /** * Test DateUtils.truncate()-method with Calendar.HOUR * - * @throws Exception + * @throws Exception so we don't have to catch it * @since 3.0 */ @Test @@ -550,7 +550,7 @@ public class DateUtilsRoundingTest { /** * Test DateUtils.truncate()-method with Calendar.HOUR_OF_DAY * - * @throws Exception + * @throws Exception so we don't have to catch it * @since 3.0 */ @Test @@ -563,7 +563,7 @@ public class DateUtilsRoundingTest { /** * Test DateUtils.truncate()-method with Calendar.MINUTE * - * @throws Exception + * @throws Exception so we don't have to catch it * @since 3.0 */ @Test @@ -576,7 +576,7 @@ public class DateUtilsRoundingTest { /** * Test DateUtils.truncate()-method with Calendar.SECOND * - * @throws Exception + * @throws Exception so we don't have to catch it * @since 3.0 */ @Test @@ -589,7 +589,7 @@ public class DateUtilsRoundingTest { /** * Test DateUtils.truncate()-method with Calendar.SECOND * - * @throws Exception + * @throws Exception so we don't have to catch it * @since 3.0 */ @Test @@ -607,7 +607,7 @@ public class DateUtilsRoundingTest { * @param roundedUpDate the next rounded date after roundedDownDate when using calendarField * @param roundedDownDate the result if lastRoundDownDate was rounded with calendarField * @param lastRoundDownDate rounding this value with calendarField will result in roundedDownDate - * @param calendarField + * @param calendarField a Calendar.field value * @since 3.0 */ protected void baseRoundTest(final Date roundedUpDate, final Date roundedDownDate, final Date lastRoundDownDate, final int calendarField) { @@ -694,9 +694,9 @@ public class DateUtilsRoundingTest { * Any January 1 could be considered as the ultimate extreme. * Instead of comparing the results if the input has a difference of 1 millisecond we check the output to be exactly January first. * - * @param minDate - * @param maxDate - * @param calendarField + * @param minDate the lower bound + * @param maxDate the upper bound + * @param calendarField a Calendar.field value * @since 3.0 */ protected void roundToJanuaryFirst(final Date minDate, final Date maxDate, final int calendarField) { diff --git a/src/test/java/org/apache/commons/lang3/time/DateUtilsTest.java b/src/test/java/org/apache/commons/lang3/time/DateUtilsTest.java index 7bb9538fa..7ef0b8ab6 100644 --- a/src/test/java/org/apache/commons/lang3/time/DateUtilsTest.java +++ b/src/test/java/org/apache/commons/lang3/time/DateUtilsTest.java @@ -650,6 +650,8 @@ public class DateUtilsTest { //----------------------------------------------------------------------- /** * Tests various values with the round method + * + * @throws java.lang.Exception so we don't have to catch it */ @Test public void testRound() throws Exception { @@ -874,6 +876,8 @@ public class DateUtilsTest { /** * Tests the Changes Made by LANG-346 to the DateUtils.modify() private method invoked * by DateUtils.round(). + * + * @throws java.lang.Exception so we don't have to catch it */ @Test public void testRoundLang346() throws Exception @@ -937,6 +941,8 @@ public class DateUtilsTest { /** * Tests various values with the trunc method + * + * @throws java.lang.Exception so we don't have to catch it */ @Test public void testTruncate() throws Exception { @@ -1130,6 +1136,8 @@ public class DateUtilsTest { /** * Tests for LANG-59 * + * @throws java.lang.Exception so we don't have to catch it + * * see http://issues.apache.org/jira/browse/LANG-59 */ @Test @@ -1219,6 +1227,8 @@ public class DateUtilsTest { /** * Tests various values with the ceiling method + * + * @throws java.lang.Exception so we don't have to catch it */ @Test public void testCeil() throws Exception { @@ -1469,6 +1479,8 @@ public class DateUtilsTest { /** * Tests the iterator exceptions + * + * @throws java.lang.Exception so we don't have to catch it */ @Test public void testIteratorEx() throws Exception { @@ -1495,6 +1507,8 @@ public class DateUtilsTest { /** * Tests the calendar iterator for week ranges + * + * @throws java.lang.Exception so we don't have to catch it */ @Test public void testWeekIterator() throws Exception { @@ -1542,6 +1556,8 @@ public class DateUtilsTest { /** * Tests the calendar iterator for month-based ranges + * + * @throws java.lang.Exception so we don't have to catch it */ @Test public void testMonthIterator() throws Exception { diff --git a/src/test/java/org/apache/commons/lang3/time/DurationFormatUtilsTest.java b/src/test/java/org/apache/commons/lang3/time/DurationFormatUtilsTest.java index 4b4889213..1e83e41b0 100644 --- a/src/test/java/org/apache/commons/lang3/time/DurationFormatUtilsTest.java +++ b/src/test/java/org/apache/commons/lang3/time/DurationFormatUtilsTest.java @@ -112,7 +112,7 @@ public class DurationFormatUtilsTest { } /** - * Tests that "1 s" gets converted to "1 " but that "11 s" is left alone. + * Tests that "1 <unit>s" gets converted to "1 <unit>" but that "11 <unit>s" is left alone. */ @Test public void testFormatDurationPluralWords() { diff --git a/src/test/java/org/apache/commons/lang3/time/FastDateFormatTest.java b/src/test/java/org/apache/commons/lang3/time/FastDateFormatTest.java index 150b683c3..2e985492e 100644 --- a/src/test/java/org/apache/commons/lang3/time/FastDateFormatTest.java +++ b/src/test/java/org/apache/commons/lang3/time/FastDateFormatTest.java @@ -254,7 +254,7 @@ public class FastDateFormatTest { * According to LANG-954 (https://issues.apache.org/jira/browse/LANG-954) this is broken in Android 2.1. */ @Test - public void testLang954() throws Exception { + public void testLang954() { final String pattern = "yyyy-MM-dd'T'"; FastDateFormat.getInstance(pattern); } 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 18fd5a870..076a20e71 100644 --- a/src/test/java/org/apache/commons/lang3/time/FastDateParserTest.java +++ b/src/test/java/org/apache/commons/lang3/time/FastDateParserTest.java @@ -77,6 +77,12 @@ public class FastDateParserTest { /** * Override this method in derived tests to change the construction of instances + * + * @param format the format string to use + * @param timeZone the time zone to use + * @param locale the locale to use + * + * @return the DateParser instance to use for testing */ protected DateParser getInstance(final String format, final TimeZone timeZone, final Locale locale) { return new FastDateParser(format, timeZone, locale, null); @@ -436,7 +442,7 @@ public class FastDateParserTest { /** * Test case for {@link FastDateParser#FastDateParser(String, TimeZone, Locale)}. - * @throws ParseException + * @throws ParseException so we don't have to catch it */ @Test public void testShortDateStyleWithLocales() throws ParseException { @@ -453,7 +459,7 @@ public class FastDateParserTest { /** * Tests that pre-1000AD years get padded with yyyy - * @throws ParseException + * @throws ParseException so we don't have to catch it */ @Test public void testLowYearPadding() throws ParseException { @@ -471,9 +477,6 @@ public class FastDateParserTest { assertEquals(cal.getTime(), parser.parse("0999/01/01")); } - /** - * @throws ParseException - */ @Test public void testMilleniumBug() throws ParseException { final DateParser parser = getInstance(DMY_DOT); diff --git a/src/test/java/org/apache/commons/lang3/time/FastDatePrinterTest.java b/src/test/java/org/apache/commons/lang3/time/FastDatePrinterTest.java index 0da92faad..eeca7c21d 100644 --- a/src/test/java/org/apache/commons/lang3/time/FastDatePrinterTest.java +++ b/src/test/java/org/apache/commons/lang3/time/FastDatePrinterTest.java @@ -62,10 +62,10 @@ public class FastDatePrinterTest { /** * Override this method in derived tests to change the construction of instances - * @param format - * @param timeZone - * @param locale - * @return + * @param format the format string to use + * @param timeZone the time zone to use + * @param locale the locale to use + * @return the DatePrinter to use for testing */ protected DatePrinter getInstance(final String format, final TimeZone timeZone, final Locale locale) { return new FastDatePrinter(format, timeZone, locale);