Details
Description
S2699 is already supporting a huge quantity of Assertion Frameworks (see RSPEC-2699) but:
- new Assertion Frameworks are becoming popular every year and developers see FPs issues while they are using assertions
- companies are creating their own Assertion Framework and S2699 is not aware of them
For these reasons, S2699 should be generalized so that any method found in test cases that have a name following this pattern (assert|verify|fail|should|check|expect).* should be considered as assertions.
Furthermore, it should be enhanced to support a parameter allowing a user to configure with wildcard style custom Assertion Frameworks method.
As an example, let's take this case: https://groups.google.com/forum/#!topic/sonarqube/Mznxgg5Ek-c:
Parameter: customAssertionMethods
Configuration: com.company.CompareToTester#testCompare*, CustomAssert#assert*
Configuration value should comply with following format <FullyQualifiedClassName>#<methodPattern>.
If in a test method, com.company.CompareToTester.testCompareTo(...) or com.company.CompareToTester.testCompareWith(...) or customAssert.assertTrue(...) or customAssert.assertWhatever(...) are used, S2699 will not raise an issue.
TODO: update RSPEC-2699 while implementing this ticket
Attachments
Issue Links
- implements
-
SONARJAVA-3027 S2699 should support Liquibase "Assert" APIs
-
- Closed
-
- is related to
-
SONARJAVA-2192 S2699 should not raise an issue when assertions are in called method
-
- Closed
-