[ 
https://issues.apache.org/jira/browse/HDDS-9951?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17810739#comment-17810739
 ] 

Zhaohui Wang commented on HDDS-9951:
------------------------------------

[~adoroszlai] Thank you for your trust, I will be happy to complete the last 
two open issues.

> 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
>            Assignee: Zhaohui Wang
>            Priority: Major
>
> Assertions in the form:
> {code}
> assertTrue(<string>.contains(...))
> assertFalse(<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(...)
> assertThat(<string>).doesNotContain(...)
> {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