[ 
https://issues.apache.org/jira/browse/HDDS-9951?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Attila Doroszlai updated HDDS-9951:
-----------------------------------
    Description: 
Assertions in the form:

{code}
assertTrue(<string>.contains(...))
{code}

do not provide any information about the actual value, if the assertion fails.

{code}
AssertionFailedError: expected: <true> but was: <false>
{code}

This can be improved by replacing them with:

{code}
import static org.assertj.core.api.Assertions.assertThat;

assertThat(<string>).contains(...)
{code}

which gives us more info in the form:

{code}
AssertionError: 

Expecting:
 <"actual string">
to contain:
 <"part"> 
{code}

Similarly, assertions about inequality relations, e.g.:

{code}
assertTrue(<x> > <y>);
{code}

can be replaced with:

{code}
assertThat(<x>).isGreaterThan(<y>);
{code}

And:

{code}
assertTrue(<x> instanceof <X>);
{code}

should be changed to

{code}
assertInstanceOf(<X>, <x>);
{code}

The goal of this task is to find and replace such {{assertTrue}} assertions.

It will be divided into subtasks, by one or more modules, to avoid too big 
changes.

  was:
Assertions in the form:

{code}
assertTrue(<string>.contains(...))
{code}

do not provide any information about the actual value, if the assertion fails.

{code}
AssertionFailedError: expected: <true> but was: <false>
{code}

This can be improved by replacing them with:

{code}
import static org.assertj.core.api.Assertions.assertThat;

assertThat(<string>).contains(...)
{code}

which gives us more info in the form:

{code}
AssertionError: 

Expecting:
 <"actual string">
to contain:
 <"part"> 
{code}

Similarly, assertions about inequality relations, e.g.:

{code}
assertTrue(<x> > <y>);
{code}

can be replaced with:

{code}
assertThat(<x>).isGreaterThan(<y>);
{code}

The goal of this task is to find and replace such {{assertTrue}} assertions.

It can be divided into subtasks, by one or more modules, to avoid too big 
changes.


> Improve assertTrue assertions
> -----------------------------
>
>                 Key: HDDS-9951
>                 URL: https://issues.apache.org/jira/browse/HDDS-9951
>             Project: Apache Ozone
>          Issue Type: Improvement
>          Components: test
>            Reporter: Attila Doroszlai
>            Priority: Major
>
> Assertions in the form:
> {code}
> assertTrue(<string>.contains(...))
> {code}
> do not provide any information about the actual value, if the assertion fails.
> {code}
> AssertionFailedError: expected: <true> but was: <false>
> {code}
> This can be improved by replacing them with:
> {code}
> import static org.assertj.core.api.Assertions.assertThat;
> assertThat(<string>).contains(...)
> {code}
> which gives us more info in the form:
> {code}
> AssertionError: 
> Expecting:
>  <"actual string">
> to contain:
>  <"part"> 
> {code}
> Similarly, assertions about inequality relations, e.g.:
> {code}
> assertTrue(<x> > <y>);
> {code}
> can be replaced with:
> {code}
> assertThat(<x>).isGreaterThan(<y>);
> {code}
> And:
> {code}
> assertTrue(<x> instanceof <X>);
> {code}
> should be changed to
> {code}
> assertInstanceOf(<X>, <x>);
> {code}
> The goal of this task is to find and replace such {{assertTrue}} assertions.
> It will be divided into subtasks, by one or more modules, to avoid too big 
> changes.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to