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

Daniel Stieglitz edited comment on NIFI-14153 at 1/13/25 10:05 PM:
-------------------------------------------------------------------

It seems that this rule does not catch when assertTrue can be simplified to 
assertArrayEquals e.g. TestSchemaRecordReaderWriter on line 155 although in 
Intellij it flags this.

 

TODO must manually search for

assertTrue(Arrays\.equals and replace the assertTrue with assertArrayEquals.

 

Also this rule does not seem to pick up with assertTrue(someObject instanceof 
someClass);

which should be replaced with assertInstanceOf as Intellij suggests

e.g. AuthorizerFactoryTest line 266

TODO must manually search for

assertTrue(.*instanceof and replace them with  assertInstanceOf 

 

Another item not picked up is assertTrue(someClass.isIstanceof(someObject)) 
which should be replaced with assertInstanceOf as Intellij suggests e.g. 
TestAvroTypeUtil line 913 and 914.

TODO must manually search for assertTrue
(.*isInstance and replace with assertInstanceOf.


was (Author: JIRAUSER294662):
It seems that this rule does not catch when assertTrue can be simplified to 
assertArrayEquals e.g. TestSchemaRecordReaderWriter on line 155 although in 
Intellij it flags this.

 

TODO must manually search for

assertTrue\\(Arrays\.equals and replace the assertTrue with assertArrayEquals.

 

Also this rule does not seem to pick up with assertTrue(someObject instanceof 
someClass);

which should be replaced with assertInstanceOf as Intellij suggests

e.g. AuthorizerFactoryTest line 266

TODO must manually search for

assertTrue\\(.*instanceof and replace them with  assertInstanceOf 

 

Another item not picked up is assertTrue(someClass.isIstanceof(someObject)) 
which should be replaced with assertInstanceOf as Intellij suggests e.g. 
TestAvroTypeUtil line 913 and 914.

TODO must manually search for assertTrue\\(.*isInstance and replace with 
assertInstanceOf.

> Apply PMD's SimplifiableTestAssertion across the code base
> ----------------------------------------------------------
>
>                 Key: NIFI-14153
>                 URL: https://issues.apache.org/jira/browse/NIFI-14153
>             Project: Apache NiFi
>          Issue Type: Improvement
>            Reporter: Daniel Stieglitz
>            Assignee: Daniel Stieglitz
>            Priority: Minor
>




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

Reply via email to