You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by Christian Schneider <ch...@die-schneider.net> on 2020/03/30 09:38:15 UTC
Sonar complains about no assertion when using Awaitility
In some of our tests we use Awaitility as the expected result will happen
asynchronously.
The code looks like:
await().until(checker::isAvailable);
This actually is like an assertion but sonar then complains that the test
does not assert anything.
Is there a way to let sonar know that using an await is also a good
assertion?
See
https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-distribution-journal&issues=AWvhm55N9kO6n_b9qo1U&open=AWvhm55N9kO6n_b9qo1U
--
--
Christian Schneider
http://www.liquid-reality.de
Computer Scientist
http://www.adobe.com
Re: Sonar complains about no assertion when using Awaitility
Posted by Christian Schneider <ch...@die-schneider.net>.
Many thanks for the hint. I asked on the forum and they created an issue to
support Awaitility:
https://jira.sonarsource.com/browse/SONARJAVA-3334
Christian
Am Mo., 30. März 2020 um 11:58 Uhr schrieb Robert Munteanu <
rombert@apache.org>:
> Hi Christian,
>
> On Mon, 2020-03-30 at 11:38 +0200, Christian Schneider wrote:
> > In some of our tests we use Awaitility as the expected result will
> > happen
> > asynchronously.
> > The code looks like:
> >
> > await().until(checker::isAvailable);
> >
> >
> > This actually is like an assertion but sonar then complains that the
> > test
> > does not assert anything.
> >
> > Is there a way to let sonar know that using an await is also a good
> > assertion?
>
> I am not aware of any specific way of doing this. Maybe a posting on
>
> https://community.sonarsource.com/c/help/sc
>
> would get you some help?
>
> Thanks,
> Robert
>
> >
> > See
> >
> https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-distribution-journal&issues=AWvhm55N9kO6n_b9qo1U&open=AWvhm55N9kO6n_b9qo1U
> >
> >
> > --
>
>
--
--
Christian Schneider
http://www.liquid-reality.de
Computer Scientist
http://www.adobe.com
Re: Sonar complains about no assertion when using Awaitility
Posted by Justin Edelson <ju...@justinedelson.com>.
On Mon, Mar 30, 2020 at 5:58 AM Robert Munteanu <ro...@apache.org> wrote:
> Hi Christian,
>
> On Mon, 2020-03-30 at 11:38 +0200, Christian Schneider wrote:
> > In some of our tests we use Awaitility as the expected result will
> > happen
> > asynchronously.
> > The code looks like:
> >
> > await().until(checker::isAvailable);
> >
> >
> > This actually is like an assertion but sonar then complains that the
> > test
> > does not assert anything.
> >
> > Is there a way to let sonar know that using an await is also a good
> > assertion?
>
Yes. See https://jira.sonarsource.com/browse/SONARJAVA-2927.
Cheers,
Justin
>
> I am not aware of any specific way of doing this. Maybe a posting on
>
> https://community.sonarsource.com/c/help/sc
>
> would get you some help?
>
> Thanks,
> Robert
>
> >
> > See
> >
> https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-distribution-journal&issues=AWvhm55N9kO6n_b9qo1U&open=AWvhm55N9kO6n_b9qo1U
> >
> >
> > --
>
>
Re: Sonar complains about no assertion when using Awaitility
Posted by Robert Munteanu <ro...@apache.org>.
Hi Christian,
On Mon, 2020-03-30 at 11:38 +0200, Christian Schneider wrote:
> In some of our tests we use Awaitility as the expected result will
> happen
> asynchronously.
> The code looks like:
>
> await().until(checker::isAvailable);
>
>
> This actually is like an assertion but sonar then complains that the
> test
> does not assert anything.
>
> Is there a way to let sonar know that using an await is also a good
> assertion?
I am not aware of any specific way of doing this. Maybe a posting on
https://community.sonarsource.com/c/help/sc
would get you some help?
Thanks,
Robert
>
> See
> https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-distribution-journal&issues=AWvhm55N9kO6n_b9qo1U&open=AWvhm55N9kO6n_b9qo1U
>
>
> --