SmartBear / soapui

SoapUI is a free and open source cross-platform functional testing solution for APIs and web services.
http://www.soapui.org
Other
1.58k stars 611 forks source link

Quality: S1155 "Collection.isEmpty()" should be used to test for emptiness #802

Open jlerbsc opened 8 months ago

jlerbsc commented 8 months ago

Below is another example of what our java code remediation solution has detected in the project's source code. In this case there are 99 violations of the Sonar rule S1155 "Collection.isEmpty()" should be used to test for emptiness". Below is an example of how our Indepth solution could fix the problem (https://www.indepth.fr) For your information, using Indepth is free for all Opensource projects.

com\eviware\soapui\ui\navigator\state\NavigatorNodesExpandStateEngine.java
@@ -83,5  +83,5 @@
    private NavigatorNodesExpandStateProvider getNavigatorNodesExpandStateProvider() {
        List<NavigatroNodeExpandStateProviderFactory> stateProviderFactoryList = SoapUI.getFactoryRegistry().getFactories(NavigatroNodeExpandStateProviderFactory.class);
-        if (stateProviderFactoryList.size() == 0) {
+        if (stateProviderFactoryList.isEmpty()) {
            return null;
        }