-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Adding concat and then for values #1029
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1029 +/- ##
============================================
+ Coverage 83.55% 83.63% +0.07%
- Complexity 3420 3433 +13
============================================
Files 331 331
Lines 26947 26961 +14
Branches 4990 4999 +9
============================================
+ Hits 22516 22549 +33
+ Misses 2941 2930 -11
+ Partials 1490 1482 -8
Continue to review full report at Codecov.
|
* @since 3.1.2 | ||
*/ | ||
@SafeVarargs | ||
public static <T> Flux<T> concat(T... values) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't get why, that's what just(T...)
is for.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@akarnokd @simonbasle That's because I'm an idiot attempting to commit at 1.30am...
* @since 3.1.2 | ||
*/ | ||
@SafeVarargs | ||
public final Flux<T> concatWith(T... values) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that one is interesting. I wonder if naming it endWith(T...)
would make sense, as a dual to startWith(T...)
So far we've typically restrained from adding aliases like these when they are simple enough, as we try to limit the number of operators the API offers... That said, this isn't the first time at least the any thought @smaldini ? |
I think in general it's good to limit the number of operations; but I'm curious as to why the policy is to exclude more simple ones? I can understand rejecting more niche operators, but since there's no easy way to add extension methods in java wouldn't it be better to include the simpler combinators especially those which are unambiguous and likely to be duped across most users codebases? |
@yilinwei simply a mater of favoring the aliases that are a bit more involved to write, since the simple aliases don't remove as much boilerplate. |
@@ -99,4 +99,15 @@ public void dontBreakFluxArrayConcatMap() { | |||
.assertNoError() | |||
.assertComplete(); | |||
} | |||
|
|||
@Test | |||
public void endWith() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nitpick: rename to concatWithValues
and prefer using StepVerifier
(rest of the test suite is old and didn't switch to this pattern, but newer tests should prefer StepVerifier
)
public void concatWithValues() { | ||
StepVerifier.create(Flux.just(1, 2).concatWithValues(4, 5, 6)) | ||
.expectNext(1, 2, 3, 4, 5, 6) | ||
.expectComplete(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oops, this should be verifyComplete()
or expectComplete().verify()
public void thenReturn() { | ||
StepVerifier.create(Mono.just(0).thenReturn(2)) | ||
.expectNext(2) | ||
.expectComplete(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here, verifyComplete()
. This actually made me notice that a couple of tests wrongly use expectComplete()
without a verify()
:(
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(I'll fix these other pre-existing bad tests on master)
Test failure on CI doesn't seem related.
|
@yilinwei right, I'll restart the job in case this is a transient failure |
Seems like there's more than one possible transient failure.
|
Add a few combinators which keeps being used within our codebase.