You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2020/11/14 15:00:57 UTC

[commons-lang] branch master updated (e832b70 -> 14b60bb)

This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/commons-lang.git.


    from e832b70  [LANG-1359] Add StopWatch.getStopTime().
     new 6aab14b  [LANG-1359] Add StopWatch.getStopTime().
     new 14b60bb  Update maven-surefire-plugin 2.22.2 -> 3.0.0-M5.

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 pom.xml                                            |   1 +
 src/changes/changes.xml                            |  11 +-
 .../apache/commons/lang3/time/StopWatchTest.java   | 125 +++++++++------------
 3 files changed, 57 insertions(+), 80 deletions(-)


[commons-lang] 01/02: [LANG-1359] Add StopWatch.getStopTime().

Posted by gg...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-lang.git

commit 6aab14bf1cd5908dd41775847b4406a06d90758c
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sat Nov 14 09:41:51 2020 -0500

    [LANG-1359] Add StopWatch.getStopTime().
    
    Simplify test.
---
 .../apache/commons/lang3/time/StopWatchTest.java   | 125 +++++++++------------
 1 file changed, 50 insertions(+), 75 deletions(-)

diff --git a/src/test/java/org/apache/commons/lang3/time/StopWatchTest.java b/src/test/java/org/apache/commons/lang3/time/StopWatchTest.java
index 50448c4..f2a3434 100644
--- a/src/test/java/org/apache/commons/lang3/time/StopWatchTest.java
+++ b/src/test/java/org/apache/commons/lang3/time/StopWatchTest.java
@@ -40,10 +40,11 @@ public class StopWatchTest {
 
     /**
      * <p>
-     * Creates a suspended StopWatch object which appears to have elapsed
-     * for the requested amount of time in nanoseconds.
+     * Creates a suspended StopWatch object which appears to have elapsed for the requested amount of time in
+     * nanoseconds.
      * <p>
      * <p>
+     *
      * <pre>
      * // Create a mock StopWatch with a time of 2:59:01.999
      * final long nanos = TimeUnit.HOURS.toNanos(2)
@@ -69,71 +70,47 @@ public class StopWatchTest {
         return watch;
     }
 
-    private void sleepQuietly(final int millis) {
-        try {
-            Thread.sleep(millis);
-        } catch (final InterruptedException ex) {
-            // ignore
-        }
+    private void sleepQuietly(final int millis) throws InterruptedException {
+        Thread.sleep(millis);
     }
 
     // test bad states
     @Test
     public void testBadStates() {
         final StopWatch watch = new StopWatch();
-        assertThrows(
-                IllegalStateException.class,
-                watch::stop,
-                "Calling stop on an unstarted StopWatch should throw an exception. ");
-
-        assertThrows(
-                IllegalStateException.class,
-                watch::suspend,
-                "Calling suspend on an unstarted StopWatch should throw an exception. ");
-
-        assertThrows(
-                IllegalStateException.class,
-                watch::split,
-                "Calling split on a non-running StopWatch should throw an exception. ");
-
-        assertThrows(
-                IllegalStateException.class,
-                watch::unsplit,
-                "Calling unsplit on an unsplit StopWatch should throw an exception. ");
-
-        assertThrows(
-                IllegalStateException.class,
-                watch::resume,
-                "Calling resume on an unsuspended StopWatch should throw an exception. ");
+        assertThrows(IllegalStateException.class, watch::stop,
+            "Calling stop on an unstarted StopWatch should throw an exception. ");
+
+        assertThrows(IllegalStateException.class, watch::suspend,
+            "Calling suspend on an unstarted StopWatch should throw an exception. ");
+
+        assertThrows(IllegalStateException.class, watch::split,
+            "Calling split on a non-running StopWatch should throw an exception. ");
+
+        assertThrows(IllegalStateException.class, watch::unsplit,
+            "Calling unsplit on an unsplit StopWatch should throw an exception. ");
+
+        assertThrows(IllegalStateException.class, watch::resume,
+            "Calling resume on an unsuspended StopWatch should throw an exception. ");
 
         watch.start();
 
-        assertThrows(
-                IllegalStateException.class,
-                watch::start,
-                "Calling start on a started StopWatch should throw an exception. ");
+        assertThrows(IllegalStateException.class, watch::start,
+            "Calling start on a started StopWatch should throw an exception. ");
 
-        assertThrows(
-                IllegalStateException.class,
-                watch::unsplit,
-                "Calling unsplit on an unsplit StopWatch should throw an exception. ");
+        assertThrows(IllegalStateException.class, watch::unsplit,
+            "Calling unsplit on an unsplit StopWatch should throw an exception. ");
 
-        assertThrows(
-                IllegalStateException.class,
-                watch::getSplitTime,
-                "Calling getSplitTime on an unsplit StopWatch should throw an exception. ");
+        assertThrows(IllegalStateException.class, watch::getSplitTime,
+            "Calling getSplitTime on an unsplit StopWatch should throw an exception. ");
 
-        assertThrows(
-                IllegalStateException.class,
-                watch::resume,
-                "Calling resume on an unsuspended StopWatch should throw an exception. ");
+        assertThrows(IllegalStateException.class, watch::resume,
+            "Calling resume on an unsuspended StopWatch should throw an exception. ");
 
         watch.stop();
 
-        assertThrows(
-                IllegalStateException.class,
-                watch::start,
-                "Calling start on a stopped StopWatch should throw an exception as it needs to be reset. ");
+        assertThrows(IllegalStateException.class, watch::start,
+            "Calling start on a stopped StopWatch should throw an exception as it needs to be reset. ");
     }
 
     @Test
@@ -199,24 +176,20 @@ public class StopWatchTest {
     public void testGetStartTime() {
         final long beforeStopWatch = System.currentTimeMillis();
         final StopWatch watch = new StopWatch();
-        assertThrows(
-                IllegalStateException.class,
-                watch::getStartTime,
-                "Calling getStartTime on an unstarted StopWatch should throw an exception");
+        assertThrows(IllegalStateException.class, watch::getStartTime,
+            "Calling getStartTime on an unstarted StopWatch should throw an exception");
         watch.start();
 
         watch.getStartTime();
         assertTrue(watch.getStartTime() >= beforeStopWatch);
 
         watch.reset();
-        assertThrows(
-                IllegalStateException.class,
-                watch::getStartTime,
-                "Calling getStartTime on a reset, but unstarted StopWatch should throw an exception");
+        assertThrows(IllegalStateException.class, watch::getStartTime,
+            "Calling getStartTime on a reset, but unstarted StopWatch should throw an exception");
     }
 
     @Test
-    public void testLang315() {
+    public void testLang315() throws InterruptedException {
         final StopWatch watch = StopWatch.createStarted();
         sleepQuietly(200);
         watch.suspend();
@@ -241,11 +214,13 @@ public class StopWatchTest {
     @Test
     public void testStopWatchGetWithTimeUnit() {
         // Create a mock StopWatch with a time of 2:59:01.999
+        // @formatter:off
         final StopWatch watch = createMockStopWatch(
-                TimeUnit.HOURS.toNanos(2)
-                        + TimeUnit.MINUTES.toNanos(59)
-                        + TimeUnit.SECONDS.toNanos(1)
-                        + TimeUnit.MILLISECONDS.toNanos(999));
+            TimeUnit.HOURS.toNanos(2)
+                    + TimeUnit.MINUTES.toNanos(59)
+                    + TimeUnit.SECONDS.toNanos(1)
+                    + TimeUnit.MILLISECONDS.toNanos(999));
+        // @formatter:on
 
         assertEquals(2L, watch.getTime(TimeUnit.HOURS));
         assertEquals(179L, watch.getTime(TimeUnit.MINUTES));
@@ -254,7 +229,7 @@ public class StopWatchTest {
     }
 
     @Test
-    public void testStopWatchSimple() {
+    public void testStopWatchSimple() throws InterruptedException {
         final StopWatch watch = StopWatch.createStarted();
         sleepQuietly(550);
         watch.stop();
@@ -269,7 +244,7 @@ public class StopWatchTest {
     }
 
     @Test
-    public void testStopTimeSimple() {
+    public void testStopTimeSimple() throws InterruptedException {
         final StopWatch watch = StopWatch.createStarted();
         final long testStartMillis = System.currentTimeMillis();
         sleepQuietly(550);
@@ -283,7 +258,7 @@ public class StopWatchTest {
     }
 
     @Test
-    public void testStopWatchSimpleGet() {
+    public void testStopWatchSimpleGet() throws InterruptedException {
         final StopWatch watch = new StopWatch();
         assertEquals(0, watch.getTime());
         assertEquals(ZERO_TIME_ELAPSED, watch.toString());
@@ -294,7 +269,7 @@ public class StopWatchTest {
     }
 
     @Test
-    public void testStopWatchSplit() {
+    public void testStopWatchSplit() throws InterruptedException {
         final StopWatch watch = StopWatch.createStarted();
         sleepQuietly(550);
         watch.split();
@@ -320,7 +295,7 @@ public class StopWatchTest {
     }
 
     @Test
-    public void testStopWatchSuspend() {
+    public void testStopWatchSuspend() throws InterruptedException {
         final StopWatch watch = StopWatch.createStarted();
         final long testStartMillis = System.currentTimeMillis();
         sleepQuietly(550);
@@ -328,7 +303,7 @@ public class StopWatchTest {
         final long testSuspendMillis = System.currentTimeMillis();
         final long suspendTime = watch.getTime();
         final long stopTime = watch.getStopTime();
-        
+
         assertTrue(testStartMillis <= stopTime);
         assertTrue(testSuspendMillis <= stopTime);
 
@@ -345,7 +320,7 @@ public class StopWatchTest {
     }
 
     @Test
-    public void testToSplitString() {
+    public void testToSplitString() throws InterruptedException {
         final StopWatch watch = StopWatch.createStarted();
         sleepQuietly(550);
         watch.split();
@@ -354,7 +329,7 @@ public class StopWatchTest {
     }
 
     @Test
-    public void testToSplitStringWithMessage() {
+    public void testToSplitStringWithMessage() throws InterruptedException {
         final StopWatch watch = new StopWatch(MESSAGE);
         watch.start();
         sleepQuietly(550);
@@ -364,7 +339,7 @@ public class StopWatchTest {
     }
 
     @Test
-    public void testToString() {
+    public void testToString() throws InterruptedException {
         //
         final StopWatch watch = StopWatch.createStarted();
         sleepQuietly(550);
@@ -374,7 +349,7 @@ public class StopWatchTest {
     }
 
     @Test
-    public void testToStringWithMessage() {
+    public void testToStringWithMessage() throws InterruptedException {
         assertTrue(new StopWatch(MESSAGE).toString().startsWith(MESSAGE));
         //
         final StopWatch watch = new StopWatch(MESSAGE);


[commons-lang] 02/02: Update maven-surefire-plugin 2.22.2 -> 3.0.0-M5.

Posted by gg...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-lang.git

commit 14b60bbb9fcd873b5c382f0f3ec2c036c7e346c9
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sat Nov 14 10:00:46 2020 -0500

    Update maven-surefire-plugin 2.22.2 -> 3.0.0-M5.
    
    Organize changes.xml for 3.12 entries.
---
 pom.xml                 |  1 +
 src/changes/changes.xml | 11 ++++++-----
 2 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/pom.xml b/pom.xml
index 622abee..a7aabdd 100644
--- a/pom.xml
+++ b/pom.xml
@@ -695,6 +695,7 @@
       <plugin>
         <groupId>org.apache.maven.plugins</groupId>
         <artifactId>maven-surefire-plugin</artifactId>
+        <version>${commons.surefire.version}</version>
         <executions>
           <execution>
             <id>plain</id>
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index cb3a1e9..caddf69 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -52,21 +52,21 @@ The <action> type attribute can be add,update,fix,remove.
     <action                   type="fix" dev="ggregory" due-to="iamchao1129">ContextedException Javadoc add missing semicolon #581.</action>
     <action issue="LANG-1608" type="fix" dev="aherbert" due-to="Edgar Asatryan">Resolve JUnit pioneer transitive dependencies using JUnit BOM.</action>
     <action                   type="fix" dev="aherbert" due-to="HubertWo, Gary Gregory">NumberUtilsTest - incorrect types in min/max tests #634.</action>
+    <action issue="LANG-1579" type="update" dev="aherbert" due-to="XenoAmess">Improve StringUtils.stripAccents conversion of remaining accents.</action>
+    <action issue="LANG-1606" type="update" dev="sebb" due-to="Rustem Galiev">StringUtils.countMatches - clarify Javadoc.</action>
+    <action issue="LANG-1591" type="update" dev="kinow" due-to="bhawna94">Remove redundant argument from substring call.</action>
     <!--  ADDS -->
     <action                   type="add" dev="ggregory" due-to="Gary Gregory">Add BooleanUtils.booleanValues().</action>
     <action                   type="add" dev="ggregory" due-to="Gary Gregory">Add BooleanUtils.primitiveValues().</action>
     <action                   type="add" dev="ggregory" due-to="Gary Gregory">Add StringUtils.containsAnyIgnoreCase(CharSequence, CharSequence...).</action>
     <action issue="LANG-1359" type="add" dev="ggregory" due-to="Gary Gregory, Keegan Witt">Add StopWatch.getStopTime().</action>
     <action                   type="add" dev="ggregory" due-to="Edgar Asatryan">More test coverage for CharSequenceUtils. #631.</action>
+    <action issue="LANG-1596" type="update" dev="aherbert" due-to="Richard Eckart de Castilho">ArrayUtils.toPrimitive(Object) does not support boolean and other types #607.</action>
     <!--  UPDATES -->
+    <action                   type="update" dev="ggregory" due-to="Gary Gregory">Enable Dependabot #587.</action>
     <action                   type="update" dev="chtompki">Bump junit-jupiter from 5.6.2 to 5.7.0.</action>
     <action                   type="update" dev="chtompki" due-to="chtompki, Dependabot">Bump spotbugs from 4.1.2 to 4.1.4, #627.</action>
     <action                   type="update" dev="chtompki" due-to="chtompki, Dependabot">Bump checkstyle from 8.36 to 8.37, #637.</action>
-    <action issue="LANG-1606" type="update" dev="sebb" due-to="Rustem Galiev">StringUtils.countMatches - clarify Javadoc.</action>
-    <action issue="LANG-1591" type="update" dev="kinow" due-to="bhawna94">Remove redundant argument from substring call.</action>
-    <action issue="LANG-1579" type="update" dev="aherbert" due-to="XenoAmess">Improve StringUtils.stripAccents conversion of remaining accents.</action>
-    <action issue="LANG-1596" type="update" dev="aherbert" due-to="Richard Eckart de Castilho">ArrayUtils.toPrimitive(Object) does not support boolean and other types #607.</action>
-    <action                   type="update" dev="ggregory" due-to="Gary Gregory">Enable Dependabot #587.</action>
     <action                   type="update" dev="ggregory" due-to="Dependabot">Update spotbugs-maven-plugin from 4.0.0 to 4.1.4, #593, #596, #609, #623, #632.</action>
     <action                   type="update" dev="ggregory" due-to="Dependabot">Update biz.aQute.bndlib from 5.1.1 to 5.2.0 #592, #628.</action>
     <action                   type="update" dev="ggregory" due-to="Dependabot">Update junit-pioneer from 0.6.0 to 1.0.0, #589, #597, #600, #624, #625.</action>
@@ -74,6 +74,7 @@ The <action> type attribute can be add,update,fix,remove.
     <action                   type="update" dev="ggregory" due-to="Dependabot">Update actions/checkout from v2.3.1 to v2.3.4 #601, #639.</action>
     <action                   type="update" dev="ggregory" due-to="Dependabot">Update actions/setup-java from v1.4.0 to v1.4.2 #612.</action>    
     <action                   type="update" dev="ggregory" due-to="Gary Gregory">Update commons.jacoco.version 0.8.5 to 0.8.6 (Fixes Java 15 builds).</action>
+    <action                   type="update" dev="ggregory" due-to="Gary Gregory">Update maven-surefire-plugin 2.22.2 -> 3.0.0-M5.</action>
   </release>
   <release version="3.11" date="2020-07-12" description="New features and bug fixes.">
     <action                   type="update" dev="chtompki" due-to="Jin Xu">Refine test output for FastDateParserTest</action>