diff --git a/src/main/java/io/reactivex/internal/functions/Functions.java b/src/main/java/io/reactivex/internal/functions/Functions.java index 5d562a8b76..b54694844f 100644 --- a/src/main/java/io/reactivex/internal/functions/Functions.java +++ b/src/main/java/io/reactivex/internal/functions/Functions.java @@ -24,7 +24,7 @@ import io.reactivex.schedulers.Timed; /** - * Utility methods to convert the Function3..Function9 instances to Function of Object array. + * Utility methods to convert the BiFunction, Function3..Function9 instances to Function of Object array. */ public final class Functions { diff --git a/src/test/java/io/reactivex/internal/functions/FunctionsTest.java b/src/test/java/io/reactivex/internal/functions/FunctionsTest.java index bea758be58..872d09df15 100644 --- a/src/test/java/io/reactivex/internal/functions/FunctionsTest.java +++ b/src/test/java/io/reactivex/internal/functions/FunctionsTest.java @@ -169,6 +169,62 @@ public Integer apply(Integer t1, Integer t2, Integer t3, Integer t4, Integer t5, }).apply(new Object[20]); } + @SuppressWarnings({"unchecked", "rawtypes"}) + @Test(expected = NullPointerException.class) + public void biFunctionFail() throws Exception { + BiFunction biFunction = null; + Functions.toFunction(biFunction); + } + + @SuppressWarnings({"unchecked", "rawtypes"}) + @Test(expected = NullPointerException.class) + public void function3Fail() throws Exception { + Function3 function3 = null; + Functions.toFunction(function3); + } + + @SuppressWarnings({"unchecked", "rawtypes"}) + @Test(expected = NullPointerException.class) + public void function4Fail() throws Exception { + Function4 function4 = null; + Functions.toFunction(function4); + } + + @SuppressWarnings({"unchecked", "rawtypes"}) + @Test(expected = NullPointerException.class) + public void function5Fail() throws Exception { + Function5 function5 = null; + Functions.toFunction(function5); + } + + @SuppressWarnings({"unchecked", "rawtypes"}) + @Test(expected = NullPointerException.class) + public void function6Fail() throws Exception { + Function6 function6 = null; + Functions.toFunction(function6); + } + + @SuppressWarnings({"unchecked", "rawtypes"}) + @Test(expected = NullPointerException.class) + public void function7Fail() throws Exception { + Function7 function7 = null; + Functions.toFunction(function7); + } + + @SuppressWarnings({"unchecked", "rawtypes"}) + @Test(expected = NullPointerException.class) + public void function8Fail() throws Exception { + Function8 function8 = null; + Functions.toFunction(function8); + } + + @SuppressWarnings({"unchecked", "rawtypes"}) + @Test(expected = NullPointerException.class) + public void function9Fail() throws Exception { + Function9 function9 = null; + Functions.toFunction(function9); + } + @Test public void identityFunctionToString() { assertEquals("IdentityFunction", Functions.identity().toString());