Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2.x: Fix wrong comments in Functions.java “Function3” -> “BiFunction” #5230

Merged
merged 5 commits into from
Mar 26, 2017
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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..Function9 instances to Function of Object array.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, BiFunction, Function3..Function9 would be better.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree.

*/
public final class Functions {

Expand Down
48 changes: 48 additions & 0 deletions src/test/java/io/reactivex/internal/functions/FunctionsTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,54 @@ public Integer apply(Integer t1, Integer t2, Integer t3, Integer t4, Integer t5,
}).apply(new Object[20]);
}

@Test(expected = NullPointerException.class)
public void biFunctionFail() throws Exception {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add @SuppressWarnings({"unchecked", "rawtypes"}) to all these new methods.

Copy link
Contributor Author

@ggikko ggikko Mar 26, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for comment.

BiFunction biFunction = null;
Functions.toFunction(biFunction);
}

@Test(expected = NullPointerException.class)
public void function3Fail() throws Exception {
Function3 function3 = null;
Functions.toFunction(function3);
}

@Test(expected = NullPointerException.class)
public void function4Fail() throws Exception {
Function4 function4 = null;
Functions.toFunction(function4);
}

@Test(expected = NullPointerException.class)
public void function5Fail() throws Exception {
Function5 function5 = null;
Functions.toFunction(function5);
}

@Test(expected = NullPointerException.class)
public void function6Fail() throws Exception {
Function6 function6 = null;
Functions.toFunction(function6);
}

@Test(expected = NullPointerException.class)
public void function7Fail() throws Exception {
Function7 function7 = null;
Functions.toFunction(function7);
}

@Test(expected = NullPointerException.class)
public void function8Fail() throws Exception {
Function8 function8 = null;
Functions.toFunction(function8);
}

@Test(expected = NullPointerException.class)
public void function9Fail() throws Exception {
Function9 function9 = null;
Functions.toFunction(function9);
}

@Test
public void identityFunctionToString() {
assertEquals("IdentityFunction", Functions.identity().toString());
Expand Down