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/12/24 15:02:43 UTC

[commons-lang] branch master updated: Add FailableShortSupplier, handy for JDBC APIs.

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


The following commit(s) were added to refs/heads/master by this push:
     new 45bec21  Add FailableShortSupplier, handy for JDBC APIs.
45bec21 is described below

commit 45bec219d2e039e85e71711e01d4543a85c1756b
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Thu Dec 24 10:02:37 2020 -0500

    Add FailableShortSupplier, handy for JDBC APIs.
---
 src/changes/changes.xml                            |   1 +
 .../apache/commons/lang3/function/Failable.java    |  21 +-
 .../lang3/function/FailableShortSupplier.java      |  38 +++
 .../lang3/function/FailableFunctionsTest.java      | 326 ++++++++++++---------
 4 files changed, 252 insertions(+), 134 deletions(-)

diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 6898081..94abb8d 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -83,6 +83,7 @@ The <action> type attribute can be add,update,fix,remove.
     <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="add" dev="ggregory" due-to="Gary Gregory">Add fluent-style ArraySorter.</action>
     <action                   type="add" dev="ggregory" due-to="Gary Gregory">Add and use LocaleUtils.toLocale(Locale) to avoid NPEs.</action>
+    <action                   type="add" dev="ggregory" due-to="Gary Gregory">Add FailableShortSupplier, handy for JDBC APIs.</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>
diff --git a/src/main/java/org/apache/commons/lang3/function/Failable.java b/src/main/java/org/apache/commons/lang3/function/Failable.java
index 04e128e..164f6aa 100644
--- a/src/main/java/org/apache/commons/lang3/function/Failable.java
+++ b/src/main/java/org/apache/commons/lang3/function/Failable.java
@@ -324,7 +324,7 @@ public class Failable {
      *
      * @param supplier The double supplier to invoke.
      * @param <E> The type of checked exception, which the supplier can throw.
-     * @return The boolean, which has been created by the supplier
+     * @return The double, which has been created by the supplier
      */
     public static <E extends Throwable> double getAsDouble(final FailableDoubleSupplier<E> supplier) {
         try {
@@ -339,7 +339,7 @@ public class Failable {
      *
      * @param supplier The int supplier to invoke.
      * @param <E> The type of checked exception, which the supplier can throw.
-     * @return The boolean, which has been created by the supplier
+     * @return The int, which has been created by the supplier
      */
     public static <E extends Throwable> int getAsInt(final FailableIntSupplier<E> supplier) {
         try {
@@ -354,7 +354,7 @@ public class Failable {
      *
      * @param supplier The long supplier to invoke.
      * @param <E> The type of checked exception, which the supplier can throw.
-     * @return The boolean, which has been created by the supplier
+     * @return The long, which has been created by the supplier
      */
     public static <E extends Throwable> long getAsLong(final FailableLongSupplier<E> supplier) {
         try {
@@ -365,6 +365,21 @@ public class Failable {
     }
 
     /**
+     * Invokes a short supplier, and returns the result.
+     *
+     * @param supplier The short supplier to invoke.
+     * @param <E> The type of checked exception, which the supplier can throw.
+     * @return The short, which has been created by the supplier
+     */
+    public static <E extends Throwable> short getAsShort(final FailableShortSupplier<E> supplier) {
+        try {
+            return supplier.getAsShort();
+        } catch (final Throwable t) {
+            throw rethrow(t);
+        }
+    }
+
+    /**
      * <p>
      * Rethrows a {@link Throwable} as an unchecked exception. If the argument is already unchecked, namely a
      * {@code RuntimeException} or {@code Error} then the argument will be rethrown without modification. If the
diff --git a/src/main/java/org/apache/commons/lang3/function/FailableShortSupplier.java b/src/main/java/org/apache/commons/lang3/function/FailableShortSupplier.java
new file mode 100644
index 0000000..f27cf34
--- /dev/null
+++ b/src/main/java/org/apache/commons/lang3/function/FailableShortSupplier.java
@@ -0,0 +1,38 @@
+/*
+ * 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.function;
+
+import java.util.function.IntSupplier;
+
+/**
+ * A functional interface like {@link IntSupplier} but for {@code short} that declares a {@code Throwable}.
+ *
+ * @param <E> Thrown exception.
+ * @since 3.12
+ */
+@FunctionalInterface
+public interface FailableShortSupplier<E extends Throwable> {
+
+    /**
+     * Supplies an int.
+     *
+     * @return a result
+     * @throws E if the supplier fails
+     */
+    short getAsShort() throws E;
+}
diff --git a/src/test/java/org/apache/commons/lang3/function/FailableFunctionsTest.java b/src/test/java/org/apache/commons/lang3/function/FailableFunctionsTest.java
index d5874bf..0d57ab2 100644
--- a/src/test/java/org/apache/commons/lang3/function/FailableFunctionsTest.java
+++ b/src/test/java/org/apache/commons/lang3/function/FailableFunctionsTest.java
@@ -223,6 +223,17 @@ public class FailableFunctionsTest {
             return 0;
         }
 
+        public short testAsShortPrimitive() throws Throwable {
+            return testAsShortPrimitive(throwable);
+        }
+
+        public short testAsShortPrimitive(final Throwable throwable) throws Throwable {
+            if (throwable != null) {
+                throw throwable;
+            }
+            return 0;
+        }
+
         public void testDouble(final double i) throws Throwable {
             test(throwable);
             acceptedPrimitiveObject1 = (P) ((Double) i);
@@ -1045,6 +1056,29 @@ public class FailableFunctionsTest {
     }
 
     @Test
+    public void testGetAsShortSupplier() {
+        final Testable<?, ?> testable = new Testable<>(ILLEGAL_STATE_EXCEPTION);
+        Throwable e = assertThrows(IllegalStateException.class,
+            () -> Failable.getAsShort(testable::testAsShortPrimitive));
+        assertSame(ILLEGAL_STATE_EXCEPTION, e);
+
+        testable.setThrowable(ERROR);
+        e = assertThrows(OutOfMemoryError.class, () -> Failable.getAsShort(testable::testAsShortPrimitive));
+        assertSame(ERROR, e);
+
+        final IOException ioe = new IOException("Unknown I/O error");
+        testable.setThrowable(ioe);
+        e = assertThrows(UncheckedIOException.class, () -> Failable.getAsShort(testable::testAsShortPrimitive));
+        final Throwable t = e.getCause();
+        assertNotNull(t);
+        assertSame(ioe, t);
+
+        testable.setThrowable(null);
+        final short i = Failable.getAsShort(testable::testAsShortPrimitive);
+        assertEquals(0, i);
+    }
+
+    @Test
     public void testGetFromSupplier() {
         FailureOnOddInvocations.invocations = 0;
         final UndeclaredThrowableException e = assertThrows(UndeclaredThrowableException.class,
@@ -1340,7 +1374,7 @@ public class FailableFunctionsTest {
     }
 
     /**
-     * Tests that our failable interface is properly defined to throw any exception. using the top level generic types
+     * Tests that our failable interface is properly defined to throw any exception using the top level generic types
      * Object and Throwable.
      */
     @Test
@@ -1371,7 +1405,7 @@ public class FailableFunctionsTest {
     }
 
     /**
-     * Tests that our failable interface is properly defined to throw any exception. using the top level generic types
+     * Tests that our failable interface is properly defined to throw any exception using the top level generic types
      * Object and Throwable.
      */
     @Test
@@ -1401,7 +1435,7 @@ public class FailableFunctionsTest {
     }
 
     /**
-     * Tests that our failable interface is properly defined to throw any exception. using the top level generic types
+     * Tests that our failable interface is properly defined to throw any exception using the top level generic types
      * Object and Throwable.
      */
     @Test
@@ -1431,37 +1465,37 @@ public class FailableFunctionsTest {
     }
 
     /**
-     * Tests that our failable interface is properly defined to throw any exception. using the top level generic types
-     * Object and Throwable.
+     * Tests that our failable interface is properly defined to throw any exception using String and IOExceptions as
+     * generic test types.
      */
     @Test
-    public void testThrows_FailableBooleanSupplier_Throwable() {
-        new FailableBooleanSupplier<Throwable>() {
+    public void testThrows_FailableBooleanSupplier_IOException() {
+        new FailableBooleanSupplier<IOException>() {
 
             @Override
-            public boolean getAsBoolean() throws Throwable {
+            public boolean getAsBoolean() throws IOException {
                 throw new IOException("test");
             }
         };
     }
 
     /**
-     * Tests that our failable interface is properly defined to throw any exception using String and IOExceptions as
-     * generic test types.
+     * Tests that our failable interface is properly defined to throw any exception using the top level generic types
+     * Object and Throwable.
      */
     @Test
-    public void testThrows_FailableBooleanSupplier_IOException() {
-        new FailableBooleanSupplier<IOException>() {
+    public void testThrows_FailableBooleanSupplier_Throwable() {
+        new FailableBooleanSupplier<Throwable>() {
 
             @Override
-            public boolean getAsBoolean() throws IOException {
+            public boolean getAsBoolean() throws Throwable {
                 throw new IOException("test");
             }
         };
     }
 
     /**
-     * Tests that our failable interface is properly defined to throw any exception. using the top level generic types
+     * Tests that our failable interface is properly defined to throw any exception using the top level generic types
      * Object and Throwable.
      */
     @Test
@@ -1491,7 +1525,7 @@ public class FailableFunctionsTest {
     }
 
     /**
-     * Tests that our failable interface is properly defined to throw any exception. using the top level generic types
+     * Tests that our failable interface is properly defined to throw any exception using the top level generic types
      * Object and Throwable.
      */
     @Test
@@ -1523,7 +1557,22 @@ public class FailableFunctionsTest {
     }
 
     /**
-     * Tests that our failable interface is properly defined to throw any exception. using the top level generic types
+     * Tests that our failable interface is properly defined to throw any exception using String and IOExceptions as
+     * generic test types.
+     */
+    @Test
+    public void testThrows_FailableDoubleBinaryOperator_IOException() {
+        new FailableDoubleBinaryOperator<IOException>() {
+
+            @Override
+            public double applyAsDouble(final double left, final double right) throws IOException {
+                throw new IOException("test");
+            }
+        };
+    }
+
+    /**
+     * Tests that our failable interface is properly defined to throw any exception using the top level generic types
      * Object and Throwable.
      */
     @Test
@@ -1542,18 +1591,18 @@ public class FailableFunctionsTest {
      * generic test types.
      */
     @Test
-    public void testThrows_FailableDoubleBinaryOperator_IOException() {
-        new FailableDoubleBinaryOperator<IOException>() {
+    public void testThrows_FailableDoubleConsumer_IOException() {
+        new FailableDoubleConsumer<IOException>() {
 
             @Override
-            public double applyAsDouble(final double left, final double right) throws IOException {
+            public void accept(final double value) throws IOException {
                 throw new IOException("test");
             }
         };
     }
 
     /**
-     * Tests that our failable interface is properly defined to throw any exception. using the top level generic types
+     * Tests that our failable interface is properly defined to throw any exception using the top level generic types
      * Object and Throwable.
      */
     @Test
@@ -1573,18 +1622,18 @@ public class FailableFunctionsTest {
      * generic test types.
      */
     @Test
-    public void testThrows_FailableDoubleConsumer_IOException() {
-        new FailableDoubleConsumer<IOException>() {
+    public void testThrows_FailableDoubleFunction_IOException() {
+        new FailableDoubleFunction<String, IOException>() {
 
             @Override
-            public void accept(final double value) throws IOException {
+            public String apply(final double input) throws IOException {
                 throw new IOException("test");
             }
         };
     }
 
     /**
-     * Tests that our failable interface is properly defined to throw any exception. using the top level generic types
+     * Tests that our failable interface is properly defined to throw any exception using the top level generic types
      * Object and Throwable.
      */
     @Test
@@ -1603,18 +1652,18 @@ public class FailableFunctionsTest {
      * generic test types.
      */
     @Test
-    public void testThrows_FailableDoubleFunction_IOException() {
-        new FailableDoubleFunction<String, IOException>() {
+    public void testThrows_FailableDoubleSupplier_IOException() {
+        new FailableDoubleSupplier<IOException>() {
 
             @Override
-            public String apply(final double input) throws IOException {
+            public double getAsDouble() throws IOException {
                 throw new IOException("test");
             }
         };
     }
 
     /**
-     * Tests that our failable interface is properly defined to throw any exception. using the top level generic types
+     * Tests that our failable interface is properly defined to throw any exception using the top level generic types
      * Object and Throwable.
      */
     @Test
@@ -1633,18 +1682,18 @@ public class FailableFunctionsTest {
      * generic test types.
      */
     @Test
-    public void testThrows_FailableDoubleSupplier_IOException() {
-        new FailableDoubleSupplier<IOException>() {
+    public void testThrows_FailableDoubleToIntFunction_IOException() {
+        new FailableDoubleToIntFunction<IOException>() {
 
             @Override
-            public double getAsDouble() throws IOException {
+            public int applyAsInt(final double value) throws IOException {
                 throw new IOException("test");
             }
         };
     }
 
     /**
-     * Tests that our failable interface is properly defined to throw any exception. using the top level generic types
+     * Tests that our failable interface is properly defined to throw any exception using the top level generic types
      * Object and Throwable.
      */
     @Test
@@ -1663,18 +1712,18 @@ public class FailableFunctionsTest {
      * generic test types.
      */
     @Test
-    public void testThrows_FailableDoubleToIntFunction_IOException() {
-        new FailableDoubleToIntFunction<IOException>() {
+    public void testThrows_FailableDoubleToLongFunction_IOException() {
+        new FailableDoubleToLongFunction<IOException>() {
 
             @Override
-            public int applyAsInt(final double value) throws IOException {
+            public int applyAsLong(final double value) throws IOException {
                 throw new IOException("test");
             }
         };
     }
 
     /**
-     * Tests that our failable interface is properly defined to throw any exception. using the top level generic types
+     * Tests that our failable interface is properly defined to throw any exception using the top level generic types
      * Object and Throwable.
      */
     @Test
@@ -1689,30 +1738,30 @@ public class FailableFunctionsTest {
     }
 
     /**
-     * Tests that our failable interface is properly defined to throw any exception using String and IOExceptions as
-     * generic test types.
+     * Tests that our failable interface is properly defined to throw any exception using the top level generic types
+     * Object and Throwable.
      */
     @Test
-    public void testThrows_FailableDoubleToLongFunction_IOException() {
-        new FailableDoubleToLongFunction<IOException>() {
+    public void testThrows_FailableFunction_Object_Throwable() {
+        new FailableFunction<Object, Object, Throwable>() {
 
             @Override
-            public int applyAsLong(final double value) throws IOException {
+            public Object apply(final Object input) throws Throwable {
                 throw new IOException("test");
             }
         };
     }
 
     /**
-     * Tests that our failable interface is properly defined to throw any exception. using the top level generic types
-     * Object and Throwable.
+     * Tests that our failable interface is properly defined to throw any exception using String and IOExceptions as
+     * generic test types.
      */
     @Test
-    public void testThrows_FailableFunction_Object_Throwable() {
-        new FailableFunction<Object, Object, Throwable>() {
+    public void testThrows_FailableFunction_String_IOException() {
+        new FailableFunction<String, String, IOException>() {
 
             @Override
-            public Object apply(final Object input) throws Throwable {
+            public String apply(final String input) throws IOException {
                 throw new IOException("test");
             }
         };
@@ -1723,18 +1772,18 @@ public class FailableFunctionsTest {
      * generic test types.
      */
     @Test
-    public void testThrows_FailableFunction_String_IOException() {
-        new FailableFunction<String, String, IOException>() {
+    public void testThrows_FailableIntBinaryOperator_IOException() {
+        new FailableIntBinaryOperator<IOException>() {
 
             @Override
-            public String apply(final String input) throws IOException {
+            public int applyAsInt(final int left, final int right) throws IOException {
                 throw new IOException("test");
             }
         };
     }
 
     /**
-     * Tests that our failable interface is properly defined to throw any exception. using the top level generic types
+     * Tests that our failable interface is properly defined to throw any exception using the top level generic types
      * Object and Throwable.
      */
     @Test
@@ -1753,18 +1802,18 @@ public class FailableFunctionsTest {
      * generic test types.
      */
     @Test
-    public void testThrows_FailableIntBinaryOperator_IOException() {
-        new FailableIntBinaryOperator<IOException>() {
+    public void testThrows_FailableIntConsumer_IOException() {
+        new FailableIntConsumer<IOException>() {
 
             @Override
-            public int applyAsInt(final int left, final int right) throws IOException {
+            public void accept(final int value) throws IOException {
                 throw new IOException("test");
             }
         };
     }
 
     /**
-     * Tests that our failable interface is properly defined to throw any exception. using the top level generic types
+     * Tests that our failable interface is properly defined to throw any exception using the top level generic types
      * Object and Throwable.
      */
     @Test
@@ -1780,30 +1829,30 @@ public class FailableFunctionsTest {
     }
 
     /**
-     * Tests that our failable interface is properly defined to throw any exception using String and IOExceptions as
-     * generic test types.
+     * Tests that our failable interface is properly defined to throw any exception using the top level generic types
+     * Object and Throwable.
      */
     @Test
-    public void testThrows_FailableIntConsumer_IOException() {
-        new FailableIntConsumer<IOException>() {
+    public void testThrows_FailableIntFunction_Object_Throwable() {
+        new FailableIntFunction<Object, Throwable>() {
 
             @Override
-            public void accept(final int value) throws IOException {
+            public Object apply(final int input) throws Throwable {
                 throw new IOException("test");
             }
         };
     }
 
     /**
-     * Tests that our failable interface is properly defined to throw any exception. using the top level generic types
-     * Object and Throwable.
+     * Tests that our failable interface is properly defined to throw any exception using String and IOExceptions as
+     * generic test types.
      */
     @Test
-    public void testThrows_FailableIntFunction_Object_Throwable() {
-        new FailableIntFunction<Object, Throwable>() {
+    public void testThrows_FailableIntFunction_String_IOException() {
+        new FailableIntFunction<String, IOException>() {
 
             @Override
-            public Object apply(final int input) throws Throwable {
+            public String apply(final int input) throws IOException {
                 throw new IOException("test");
             }
         };
@@ -1814,18 +1863,18 @@ public class FailableFunctionsTest {
      * generic test types.
      */
     @Test
-    public void testThrows_FailableIntFunction_String_IOException() {
-        new FailableIntFunction<String, IOException>() {
+    public void testThrows_FailableIntSupplier_IOException() {
+        new FailableIntSupplier<IOException>() {
 
             @Override
-            public String apply(final int input) throws IOException {
+            public int getAsInt() throws IOException {
                 throw new IOException("test");
             }
         };
     }
 
     /**
-     * Tests that our failable interface is properly defined to throw any exception. using the top level generic types
+     * Tests that our failable interface is properly defined to throw any exception using the top level generic types
      * Object and Throwable.
      */
     @Test
@@ -1844,18 +1893,18 @@ public class FailableFunctionsTest {
      * generic test types.
      */
     @Test
-    public void testThrows_FailableIntSupplier_IOException() {
-        new FailableIntSupplier<IOException>() {
+    public void testThrows_FailableIntToDoubleFunction_IOException() {
+        new FailableIntToDoubleFunction<IOException>() {
 
             @Override
-            public int getAsInt() throws IOException {
+            public double applyAsDouble(final int value) throws IOException {
                 throw new IOException("test");
             }
         };
     }
 
     /**
-     * Tests that our failable interface is properly defined to throw any exception. using the top level generic types
+     * Tests that our failable interface is properly defined to throw any exception using the top level generic types
      * Object and Throwable.
      */
     @Test
@@ -1874,18 +1923,18 @@ public class FailableFunctionsTest {
      * generic test types.
      */
     @Test
-    public void testThrows_FailableIntToDoubleFunction_IOException() {
-        new FailableIntToDoubleFunction<IOException>() {
+    public void testThrows_FailableIntToLongFunction_IOException() {
+        new FailableIntToLongFunction<IOException>() {
 
             @Override
-            public double applyAsDouble(final int value) throws IOException {
+            public long applyAsLong(final int value) throws IOException {
                 throw new IOException("test");
             }
         };
     }
 
     /**
-     * Tests that our failable interface is properly defined to throw any exception. using the top level generic types
+     * Tests that our failable interface is properly defined to throw any exception using the top level generic types
      * Object and Throwable.
      */
     @Test
@@ -1904,18 +1953,18 @@ public class FailableFunctionsTest {
      * generic test types.
      */
     @Test
-    public void testThrows_FailableIntToLongFunction_IOException() {
-        new FailableIntToLongFunction<IOException>() {
+    public void testThrows_FailableLongBinaryOperator_IOException() {
+        new FailableLongBinaryOperator<IOException>() {
 
             @Override
-            public long applyAsLong(final int value) throws IOException {
+            public long applyAsLong(final long left, final long right) throws IOException {
                 throw new IOException("test");
             }
         };
     }
 
     /**
-     * Tests that our failable interface is properly defined to throw any exception. using the top level generic types
+     * Tests that our failable interface is properly defined to throw any exception using the top level generic types
      * Object and Throwable.
      */
     @Test
@@ -1934,18 +1983,19 @@ public class FailableFunctionsTest {
      * generic test types.
      */
     @Test
-    public void testThrows_FailableLongBinaryOperator_IOException() {
-        new FailableLongBinaryOperator<IOException>() {
+    public void testThrows_FailableLongConsumer_IOException() {
+        new FailableLongConsumer<IOException>() {
 
             @Override
-            public long applyAsLong(final long left, final long right) throws IOException {
+            public void accept(final long object) throws IOException {
                 throw new IOException("test");
+
             }
         };
     }
 
     /**
-     * Tests that our failable interface is properly defined to throw any exception. using the top level generic types
+     * Tests that our failable interface is properly defined to throw any exception using the top level generic types
      * Object and Throwable.
      */
     @Test
@@ -1965,19 +2015,18 @@ public class FailableFunctionsTest {
      * generic test types.
      */
     @Test
-    public void testThrows_FailableLongConsumer_IOException() {
-        new FailableLongConsumer<IOException>() {
+    public void testThrows_FailableLongFunction_IOException() {
+        new FailableLongFunction<String, IOException>() {
 
             @Override
-            public void accept(final long object) throws IOException {
+            public String apply(final long input) throws IOException {
                 throw new IOException("test");
-
             }
         };
     }
 
     /**
-     * Tests that our failable interface is properly defined to throw any exception. using the top level generic types
+     * Tests that our failable interface is properly defined to throw any exception using the top level generic types
      * Object and Throwable.
      */
     @Test
@@ -1996,18 +2045,18 @@ public class FailableFunctionsTest {
      * generic test types.
      */
     @Test
-    public void testThrows_FailableLongFunction_IOException() {
-        new FailableLongFunction<String, IOException>() {
+    public void testThrows_FailableLongSupplier_IOException() {
+        new FailableLongSupplier<IOException>() {
 
             @Override
-            public String apply(final long input) throws IOException {
+            public long getAsLong() throws IOException {
                 throw new IOException("test");
             }
         };
     }
 
     /**
-     * Tests that our failable interface is properly defined to throw any exception. using the top level generic types
+     * Tests that our failable interface is properly defined to throw any exception using the top level generic types
      * Object and Throwable.
      */
     @Test
@@ -2026,18 +2075,18 @@ public class FailableFunctionsTest {
      * generic test types.
      */
     @Test
-    public void testThrows_FailableLongSupplier_IOException() {
-        new FailableLongSupplier<IOException>() {
+    public void testThrows_FailableLongToDoubleFunction_IOException() {
+        new FailableLongToDoubleFunction<IOException>() {
 
             @Override
-            public long getAsLong() throws IOException {
+            public double applyAsDouble(final long value) throws IOException {
                 throw new IOException("test");
             }
         };
     }
 
     /**
-     * Tests that our failable interface is properly defined to throw any exception. using the top level generic types
+     * Tests that our failable interface is properly defined to throw any exception using the top level generic types
      * Object and Throwable.
      */
     @Test
@@ -2056,18 +2105,18 @@ public class FailableFunctionsTest {
      * generic test types.
      */
     @Test
-    public void testThrows_FailableLongToDoubleFunction_IOException() {
-        new FailableLongToDoubleFunction<IOException>() {
+    public void testThrows_FailableLongToIntFunction_IOException() {
+        new FailableLongToIntFunction<IOException>() {
 
             @Override
-            public double applyAsDouble(final long value) throws IOException {
+            public int applyAsInt(final long value) throws IOException {
                 throw new IOException("test");
             }
         };
     }
 
     /**
-     * Tests that our failable interface is properly defined to throw any exception. using the top level generic types
+     * Tests that our failable interface is properly defined to throw any exception using the top level generic types
      * Object and Throwable.
      */
     @Test
@@ -2082,22 +2131,7 @@ public class FailableFunctionsTest {
     }
 
     /**
-     * Tests that our failable interface is properly defined to throw any exception using String and IOExceptions as
-     * generic test types.
-     */
-    @Test
-    public void testThrows_FailableLongToIntFunction_IOException() {
-        new FailableLongToIntFunction<IOException>() {
-
-            @Override
-            public int applyAsInt(final long value) throws IOException {
-                throw new IOException("test");
-            }
-        };
-    }
-
-    /**
-     * Tests that our failable interface is properly defined to throw any exception. using the top level generic types
+     * Tests that our failable interface is properly defined to throw any exception using the top level generic types
      * Object and Throwable.
      */
     @Test
@@ -2128,7 +2162,7 @@ public class FailableFunctionsTest {
     }
 
     /**
-     * Tests that our failable interface is properly defined to throw any exception. using the top level generic types
+     * Tests that our failable interface is properly defined to throw any exception using the top level generic types
      * Object and Throwable.
      */
     @Test
@@ -2159,7 +2193,7 @@ public class FailableFunctionsTest {
     }
 
     /**
-     * Tests that our failable interface is properly defined to throw any exception. using the top level generic types
+     * Tests that our failable interface is properly defined to throw any exception using the top level generic types
      * Object and Throwable.
      */
     @Test
@@ -2190,7 +2224,7 @@ public class FailableFunctionsTest {
     }
 
     /**
-     * Tests that our failable interface is properly defined to throw any exception. using the top level generic types
+     * Tests that our failable interface is properly defined to throw any exception using the top level generic types
      * Object and Throwable.
      */
     @Test
@@ -2220,7 +2254,22 @@ public class FailableFunctionsTest {
     }
 
     /**
-     * Tests that our failable interface is properly defined to throw any exception. using the top level generic types
+     * Tests that our failable interface is properly defined to throw any exception using String and IOExceptions as
+     * generic test types.
+     */
+    @Test
+    public void testThrows_FailableRunnable_IOException() {
+        new FailableRunnable<IOException>() {
+
+            @Override
+            public void run() throws IOException {
+                throw new IOException("test");
+            }
+        };
+    }
+
+    /**
+     * Tests that our failable interface is properly defined to throw any exception using the top level generic types
      * Object and Throwable.
      */
     @Test
@@ -2240,18 +2289,33 @@ public class FailableFunctionsTest {
      * generic test types.
      */
     @Test
-    public void testThrows_FailableRunnable_IOException() {
-        new FailableRunnable<IOException>() {
+    public void testThrows_FailableShortSupplier_IOException() {
+        new FailableShortSupplier<IOException>() {
 
             @Override
-            public void run() throws IOException {
+            public short getAsShort() throws IOException {
+                throw new IOException("test");
+            }
+        };
+    }
+
+    /**
+     * Tests that our failable interface is properly defined to throw any exception using the top level generic types
+     * Object and Throwable.
+     */
+    @Test
+    public void testThrows_FailableShortSupplier_Throwable() {
+        new FailableShortSupplier<Throwable>() {
+
+            @Override
+            public short getAsShort() throws Throwable {
                 throw new IOException("test");
             }
         };
     }
 
     /**
-     * Tests that our failable interface is properly defined to throw any exception. using the top level generic types
+     * Tests that our failable interface is properly defined to throw any exception using the top level generic types
      * Object and Throwable.
      */
     @Test
@@ -2281,7 +2345,7 @@ public class FailableFunctionsTest {
     }
 
     /**
-     * Tests that our failable interface is properly defined to throw any exception. using the top level generic types
+     * Tests that our failable interface is properly defined to throw any exception using the top level generic types
      * Object and Throwable.
      */
     @Test
@@ -2311,7 +2375,7 @@ public class FailableFunctionsTest {
     }
 
     /**
-     * Tests that our failable interface is properly defined to throw any exception. using the top level generic types
+     * Tests that our failable interface is properly defined to throw any exception using the top level generic types
      * Object and Throwable.
      */
     @Test
@@ -2341,7 +2405,7 @@ public class FailableFunctionsTest {
     }
 
     /**
-     * Tests that our failable interface is properly defined to throw any exception. using the top level generic types
+     * Tests that our failable interface is properly defined to throw any exception using the top level generic types
      * Object and Throwable.
      */
     @Test
@@ -2371,7 +2435,7 @@ public class FailableFunctionsTest {
     }
 
     /**
-     * Tests that our failable interface is properly defined to throw any exception. using the top level generic types
+     * Tests that our failable interface is properly defined to throw any exception using the top level generic types
      * Object and Throwable.
      */
     @Test
@@ -2401,7 +2465,7 @@ public class FailableFunctionsTest {
     }
 
     /**
-     * Tests that our failable interface is properly defined to throw any exception. using the top level generic types
+     * Tests that our failable interface is properly defined to throw any exception using the top level generic types
      * Object and Throwable.
      */
     @Test
@@ -2431,7 +2495,7 @@ public class FailableFunctionsTest {
     }
 
     /**
-     * Tests that our failable interface is properly defined to throw any exception. using the top level generic types
+     * Tests that our failable interface is properly defined to throw any exception using the top level generic types
      * Object and Throwable.
      */
     @Test