ARMS2025 opened a new pull request, #53: URL: https://github.com/apache/sling-org-apache-sling-servlets-resolver/pull/53
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 1. 1 stubbing which stubbed `getProperty` method is created in `PathBasedServletAcceptorTest.assertAccept`, was executed with argument "sling.servlet.methods", but was not stubbed, resulting in mismatched stubbing. This mismatch occurred in tests: `extensionMatchOneInN`, `extensionPropertyNotSet`, `selectorOneMatchesOne`, `selectorOneFromNInN`, `selectorOneInN`, `selectorPropertyNotSet`, `methodPropertyNotSet`, `testEmptyExtensionAndSelectorWithEmpty`, `testEmptyExtensionSpecificSelector`, `testEmptySelectorSpecificExtension`. 2. 1 stubbing which stubbed `getProperty` method is created in `PathBasedServletAcceptorTest.assertAccept`, was executed with argument "sling.servlet.extensions", but was not stubbed, resulting in mismatched stubbing. This mismatch occurred in tests: `extensionPropertyNotSet`, `selectorOneMatchesOne`, `selectorOneFromNInN`, `selectorZeroInN`, `selectorOneInN`, `selectorPropertyNotSet`, `methodNoMatch`, `methodPropertyNotSet`, `testStringStrict`, `testEmptyMethodException`. 3. 1 stubbing which stubbed `getProperty` method is created in `PathBasedServletAcceptorTest.assertAccept`, was executed with argument "sling.servlet.selectors", but was not stubbed, resulting in mismatched stubbing. This mismatch occurred in tests: `extensionMatchOneInN`, `extensionPropertyNotSet`, `selectorPropertyNotSet`, `methodNoMatch`, `methodPropertyNotSet`, `testStringStrict`, `testEmptyMethodException`. 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). We propose a solution below to resolve the mismatch stubbings. -- 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: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
