You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by "ARMS2025 (via GitHub)" <gi...@apache.org> on 2025/03/10 03:36:56 UTC

[PR] Resolve 35 mismatch stubbings in ServletResourceProviderCreateTest.java [sling-org-apache-sling-servlets-resolver]

ARMS2025 opened a new pull request, #56:
URL: https://github.com/apache/sling-org-apache-sling-servlets-resolver/pull/56

   We are researchers and analyzed the test doubles (mocks) in the test code of the project. In our analysis of the project, we observed that
   
   + In the `testCreateMethodsDefault` test, 1 stubbing for the `getProperty` method is stubbed with the argument "service.id", but in actual execution, it is called with the argument "sling.servlet.paths". Additionally, the `getProperty` method is called with "sling.servlet.selectors", "sling.servlet.extensions", "sling.servlet.methods", "sling.servlet.prefix", and "sling.servlet.resourceSuperType", none of which were stubbed, resulting in mismatch stubbings.
   
   + In the `testCreateMethodsSingle` test, 1 stubbing for the `getProperty` method is stubbed with the argument "service.id", but in actual execution, it is called with the argument "sling.servlet.paths". Additionally, the `getProperty` method is called with "sling.servlet.selectors", "sling.servlet.extensions", "sling.servlet.prefix", and "sling.servlet.resourceSuperType", none of which were stubbed, resulting in mismatch stubbings.
   
   + In the `testCreateMethodsMultiple` test, 1 stubbing for the `getProperty` method is stubbed with the argument "service.id", but in actual execution, it is called with the argument "sling.servlet.paths". Additionally, the `getProperty` method is called with "sling.servlet.selectors", "sling.servlet.extensions", "sling.servlet.prefix", and "sling.servlet.resourceSuperType", none of which were stubbed, resulting in mismatch stubbings.
   
   +  In the `testCreateMethodsAll` test, 1 stubbing for the `getProperty` method is stubbed with the argument "service.id", but in actual execution, it is called with the argument "sling.servlet.paths". Additionally, the `getProperty` method is called with "sling.servlet.selectors", "sling.servlet.extensions", "sling.servlet.prefix", and "sling.servlet.resourceSuperType", none of which were stubbed, resulting in mismatch stubbings.
   
   + In the `testCreateSelectorsExtensions` test, 1 stubbing for the `getProperty` method is stubbed with the argument "service.id", but in actual execution, it is called with the argument "sling.servlet.paths". Additionally, the `getProperty` method is called with "sling.servlet.prefix" and "sling.servlet.resourceSuperType", none of which were stubbed, resulting in mismatch stubbings.
   
   + In the `testCreateMethodsExtensions` test, 1 stubbing for the `getProperty` method is stubbed with the argument "service.id", but in actual execution, it is called with the argument "sling.servlet.paths". Additionally, the `getProperty` method is called with "sling.servlet.selectors", "sling.servlet.prefix", and "sling.servlet.resourceSuperType", none of which were stubbed, resulting in mismatch stubbings.
   
   + In the `testCreateWithResourceSuperType` test, 1 stubbing for the `getProperty` method is stubbed with the argument "service.id", but in actual execution, it is called with the argument "sling.servlet.paths". Additionally, the `getProperty` method is called with "sling.servlet.selectors", "sling.servlet.methods", and "sling.servlet.prefix", none of which were stubbed, resulting in mismatch stubbings.
   
   + In the `testCreateWithDefaultResourceSuperType` test, 1 stubbing for the `getProperty` method is stubbed with the argument "service.id", but in actual execution, it is called with the argument "sling.servlet.paths". Additionally, the `getProperty` method is called with "sling.servlet.methods" and "sling.servlet.prefix", none of which were stubbed, resulting in mismatch stubbings.
   
   In this pull request, we propose a solution to resolve the mismatch stubbing. 
   
   Mismatched stubbing occurs when a mocked method is stubbed with specific arguments in a test but later invoked with different arguments in the code, potentially causing unexpected behavior. Mockito recommends addressing these issues, (https://www.javadoc.io/doc/org.mockito/mockito-core/latest/org/mockito/exceptions/misusing/PotentialStubbingProblem.html).


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@sling.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Resolve 35 mismatch stubbings in ServletResourceProviderCreateTest.java [sling-org-apache-sling-servlets-resolver]

Posted by "cziegeler (via GitHub) via dev" <de...@sling.apache.org>.
cziegeler closed pull request #56: Resolve 35 mismatch stubbings in ServletResourceProviderCreateTest.java
URL: https://github.com/apache/sling-org-apache-sling-servlets-resolver/pull/56


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@sling.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Resolve 35 mismatch stubbings in ServletResourceProviderCreateTest.java [sling-org-apache-sling-servlets-resolver]

Posted by "cziegeler (via GitHub) via dev" <de...@sling.apache.org>.
cziegeler commented on PR #56:
URL: https://github.com/apache/sling-org-apache-sling-servlets-resolver/pull/56#issuecomment-6761582000

   First of all, thanks for the PR.
   
   Getting rid of warnings is good, however, looking at the massive changes, I think its not worth the effort here. It wasnt a real issue for years.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@sling.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Resolve 35 mismatch stubbings in ServletResourceProviderCreateTest.java [sling-org-apache-sling-servlets-resolver]

Posted by "sonarqubecloud[bot] (via GitHub)" <gi...@apache.org>.
sonarqubecloud[bot] commented on PR #56:
URL: https://github.com/apache/sling-org-apache-sling-servlets-resolver/pull/56#issuecomment-2711321196

   ## [![Quality Gate Passed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/qg-passed-20px.png 'Quality Gate Passed')](https://sonarcloud.io/dashboard?id=apache_sling-org-apache-sling-servlets-resolver&pullRequest=56) **Quality Gate passed**  
   Issues  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [1 New issue](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-servlets-resolver&pullRequest=56&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/accepted-16px.png '') [0 Accepted issues](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-servlets-resolver&pullRequest=56&issueStatuses=ACCEPTED)
   
   Measures  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_sling-org-apache-sling-servlets-resolver&pullRequest=56&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [0.0% Coverage on New Code](https://sonarcloud.io/component_measures?id=apache_sling-org-apache-sling-servlets-resolver&pullRequest=56&metric=new_coverage&view=list)  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [0.0% Duplication on New Code](https://sonarcloud.io/component_measures?id=apache_sling-org-apache-sling-servlets-resolver&pullRequest=56&metric=new_duplicated_lines_density&view=list)  
     
   [See analysis details on SonarQube Cloud](https://sonarcloud.io/dashboard?id=apache_sling-org-apache-sling-servlets-resolver&pullRequest=56)
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@sling.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org