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

Enhance testing utilities #494

Merged
merged 7 commits into from
Mar 10, 2021
Merged

Enhance testing utilities #494

merged 7 commits into from
Mar 10, 2021

Conversation

cescoffier
Copy link
Contributor

Fix #465

The PR adds:

in UniAssertSubscriber:

  • awaitItem - with and without duration
  • awaitFailure- with and without duration and validation of the failure
  • awaitSubscription - with or without duration

in AssertSubscriber:

  • awaitCompletion - with and without duration
  • awaitFailure- with and without duration and validation of the failure
  • awaitNextItems and awaitNextItem
  • awaitSubscription - with or without duration
  • assertLastItem and getLastItem

…ave a message (such as an NPE or a TimeoutException)
Also refactor the internal of the class to prepare for the "await" methods
* awaitNextItem and awaitNextItems
* awaitFailure
* awaitCompletion
* getLastItem
* assertLastItem
* awaitItem
* awaitFailure
* awaitSubscription
@cescoffier cescoffier requested a review from jponge March 5, 2021 10:15
@cescoffier cescoffier added the enhancement New feature or request label Mar 5, 2021
@cescoffier cescoffier added this to the 0.15.0 milestone Mar 5, 2021
@jponge
Copy link
Member

jponge commented Mar 5, 2021

Oh there's an issue in MultiGroupTest.testGroupByWithUpstreamFailure

@cescoffier
Copy link
Contributor Author

It means the assertions are working :-)

More seriously, there is a race. When the source started to emit items, you can't really awaitNextItems as it may have already received some.

We may need to introduce another assertion, awaiting for a total number of items is received (but should it be strict or anything greater would be ok).

@codecov
Copy link

codecov bot commented Mar 6, 2021

Codecov Report

Merging #494 (d2045da) into main (f8bb371) will increase coverage by 0.16%.
The diff coverage is 87.08%.

Impacted file tree graph

@@             Coverage Diff              @@
##               main     #494      +/-   ##
============================================
+ Coverage     89.95%   90.11%   +0.16%     
- Complexity     2931     3005      +74     
============================================
  Files           382      382              
  Lines         11340    11577     +237     
  Branches       1420     1446      +26     
============================================
+ Hits          10201    10433     +232     
- Misses          578      581       +3     
- Partials        561      563       +2     
Impacted Files Coverage Δ Complexity Δ
...e/mutiny/helpers/spies/MultiOnCancellationSpy.java 69.23% <33.33%> (-30.77%) 6.00 <2.00> (+2.00) ⬇️
.../smallrye/mutiny/helpers/test/AssertionHelper.java 73.39% <42.85%> (-4.16%) 48.00 <2.00> (+3.00) ⬇️
...n/java/io/smallrye/mutiny/groups/UniOnFailure.java 91.89% <50.00%> (-8.11%) 25.00 <1.00> (-1.00)
...llrye/mutiny/helpers/test/UniAssertSubscriber.java 91.85% <87.83%> (-5.83%) 54.00 <27.00> (+17.00) ⬇️
...smallrye/mutiny/helpers/test/AssertSubscriber.java 93.90% <93.06%> (-3.54%) 73.00 <48.00> (+43.00) ⬇️
...tiny/operators/uni/builders/DefaultUniEmitter.java 93.10% <0.00%> (-6.90%) 12.00% <0.00%> (-1.00%)
...mallrye/mutiny/helpers/queues/MpscLinkedQueue.java 90.32% <0.00%> (-6.46%) 27.00% <0.00%> (-1.00%)
...erators/multi/builders/SerializedMultiEmitter.java 81.01% <0.00%> (-1.27%) 25.00% <0.00%> (-1.00%)
...smallrye/mutiny/operators/multi/MultiBufferOp.java 88.70% <0.00%> (-0.81%) 5.00% <0.00%> (ø%)
... and 11 more

Base automatically changed from master to main March 9, 2021 16:42
Copy link
Member

@jponge jponge left a comment

Choose a reason for hiding this comment

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

See typo, otherwise a great PR!

@jponge jponge merged commit 4b5f7e6 into main Mar 10, 2021
@jponge jponge deleted the testing-api-improvements branch March 10, 2021 10:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add possibility to wait for the next event testing utils
2 participants