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

Fix #338 - Exception when trying to zip an iterable of several FluxJust-s #340

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all 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
2 changes: 2 additions & 0 deletions src/main/java/reactor/util/function/Tuples.java
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ public static Tuple2 fromArray(Object[] list) {
return of(list[0], list[1], list[2], list[3], list[4], list[5]);
case 7:
return of(list[0], list[1], list[2], list[3], list[4], list[5], list[6]);
case 8:
return of(list[0], list[1], list[2], list[3], list[4], list[5], list[6], list[7]);
}
throw new IllegalArgumentException("too many arguments ("+list.length+"), 8 " +
"maximum supported");
Expand Down
11 changes: 11 additions & 0 deletions src/test/java/reactor/util/function/TupleTests.java
Original file line number Diff line number Diff line change
Expand Up @@ -65,5 +65,16 @@ public void tuplesOfDifferentLengthAreNotEqual() {
assertThat("Tuples of different length are not equal.", t2, is(Matchers.not((Tuple2<String, Long>) t3)));
}

@Test
public void tuplesCanBeCreatedFromAnArrayOfLength8() {
Tuple2 tuple2 = Tuples.fromArray(new Object[8]);
assertThat("Tuple created from array of length 8 is Tuple8", Tuple8.class.isInstance(tuple2));
}

@Test(expected = IllegalArgumentException.class)
public void tuplesCanNotBeCreatedFromAnArrayLongerThen8() {
Tuples.fromArray(new Object[9]);
}


}