Skip to content

Conversation

@mipo256
Copy link
Contributor

@mipo256 mipo256 commented Jun 14, 2024

Added a new willCompleteWithValueMatching method to AbstractCompletableFutureAssert to check that CompletableFuture will complete within the given period with value matching given Predicate. Found this kind of assertion very handy in my project.

@joel-costigliola
Copy link
Member

Thanks @mipo256, we will review your PR shortly !

@joel-costigliola
Copy link
Member

@mipo256 the code does not compile on java 8 which is AssertJ Core 3.x baseline, can you fix it ?

FYI we will bump it to java 17 for 4.x

@mipo256
Copy link
Contributor Author

mipo256 commented Jun 15, 2024

Hey @joel-costigliola, of course, I can fix it to run on JDK 8. Will do it today.

P.SL In contribution guidelines it is mentioned that the project needs to be built with JDK 17

@scordio
Copy link
Member

scordio commented Jun 15, 2024

We actually raised it to 21 for building it 🙃 but the language syntax and feature set that can be used in the code are still restricted to 8

@mipo256 mipo256 force-pushed the add-completable-future-assertion branch 2 times, most recently from 72e5f56 to ff8ab54 Compare June 15, 2024 19:29
@mipo256 mipo256 force-pushed the add-completable-future-assertion branch from ff8ab54 to 59bbca7 Compare June 15, 2024 19:35
@mipo256
Copy link
Contributor Author

mipo256 commented Jun 15, 2024

Thanks. guys, I've fixed it. Now the build should run just fine.

FYI: @joel-costigliola, @scordio

@mipo256
Copy link
Contributor Author

mipo256 commented Aug 23, 2024

Hey @joel-costigliola, any news on reviewing this PR?

@joel-costigliola joel-costigliola self-requested a review August 23, 2024 20:45
@joel-costigliola joel-costigliola added this to the 3.27.0 milestone Aug 23, 2024
@joel-costigliola
Copy link
Member

@mipo256 thanks for the reminder, we'll include this issue in our next release.

@joel-costigliola
Copy link
Member

LGTM, I'm integrating it but will rename the assertion to isCompletedWithValueMatchingWithin(Predicate<RESULT> resultPredicate, Duration completionDuration) and invert the parameters to be consistent with the other assertions.

ex:

 assertThat(completedFuture("something")).isCompletedWithValueMatchingWithin(result -> result.equals("something"),
                                                                            Duration.ofSeconds(10));

@joel-costigliola
Copy link
Member

Integrated thanks @mipo256 !

@mipo256
Copy link
Contributor Author

mipo256 commented Aug 24, 2024

LGTM, I'm integrating it but will rename the assertion to isCompletedWithValueMatchingWithin(Predicate<RESULT> resultPredicate, Duration completionDuration) and invert the parameters to be consistent with the other assertions.

ex:

 assertThat(completedFuture("something")).isCompletedWithValueMatchingWithin(result -> result.equals("something"),
                                                                            Duration.ofSeconds(10));

Okay, fine, thanks!)

@joel-costigliola
Copy link
Member

You'll get the full credit for it anyway ;-)

@scordio scordio changed the title Added assertion for completable future for it to complete within peri… Add isCompletedWithValueMatchingWithin to CompletableFuture assertions Dec 14, 2024
nosan pushed a commit to nosan/assertj that referenced this pull request Mar 4, 2025
… a given period and a value that satisfies a predicate

Fix assertj#3506
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants