volodya-lombrozo / jtcop

Maven Plugin for checking tests in Java projects
MIT License
18 stars 2 forks source link

feat(#393): RuleTestCaseContainsMockery, NumberOfMockitoMocks #395

Closed h1alexbel closed 2 months ago

h1alexbel commented 2 months ago

In this pull request I've introduced new rule RuleTestCaseContainsMockery for mockery detection with Mockito mocking framework.

@volodya-lombrozo take a look, please closes #393


PR-Codex overview

This PR introduces a new rule to limit the number of mocks in test cases. It also adds support for JavaParser and updates dependencies.

Detailed summary

The following files were skipped due to too many changes: src/test/resources/Mockery.java, src/it/exclusions/src/test/java/MockeryTest.java, src/test/resources/MockerySuppressed.java, docs/rules/mockery.md, src/test/java/com/github/lombrozo/testnames/javaparser/JavaParserTestCaseTest.java, src/main/java/com/github/lombrozo/testnames/javaparser/NumberOfMockitoMocks.java, src/test/java/com/github/lombrozo/testnames/javaparser/NumberOfMockitoMocksTest.java, src/test/java/com/github/lombrozo/testnames/rules/RuleTestCaseContainsMockeryTest.java, src/main/java/com/github/lombrozo/testnames/TestCase.java, src/main/java/com/github/lombrozo/testnames/rules/RuleTestCaseContainsMockery.java

✨ Ask PR-Codex anything about this PR by commenting with /codex {your question}

h1alexbel commented 2 months ago

@volodya-lombrozo updated, take a look, please

h1alexbel commented 2 months ago

@volodya-lombrozo I also researched the subject of detecting mockery and other similar patterns and found a few papers where researchers studied mock practices in the unit tests:

At the moment I didn't found any practical tool that checks or alerts excessive mocking/stubbing.

volodya-lombrozo commented 2 months ago

@rultor merge

volodya-lombrozo commented 2 months ago

@volodya-lombrozo I also researched the subject of detecting mockery and other similar patterns and found a few papers where researchers studied mock practices in the unit tests:

At the moment I didn't found any practical tool that checks or alerts excessive mocking/stubbing.

Good! Then we will be the first one.

rultor commented 2 months ago

@rultor merge

@volodya-lombrozo OK, I'll try to merge now. You can check the progress of the merge here

rultor commented 2 months ago

@rultor merge

@volodya-lombrozo Done! FYI, the full log is here (took me 6min)