mirror of
https://github.com/github/codeql.git
synced 2026-04-24 00:05:14 +02:00
Java: Renamed query java/mocking-all-non-private-methods-means-unit-test-is-too-big to java/excessive-public-method-mocking and changed wording from non-private to public
This commit is contained in:
@@ -36,8 +36,8 @@ ql/java/ql/src/Likely Bugs/Concurrency/NonSynchronizedOverride.ql
|
||||
ql/java/ql/src/Likely Bugs/Concurrency/ScheduledThreadPoolExecutorZeroThread.ql
|
||||
ql/java/ql/src/Likely Bugs/Concurrency/SynchOnBoxedType.ql
|
||||
ql/java/ql/src/Likely Bugs/Concurrency/SynchSetUnsynchGet.ql
|
||||
ql/java/ql/src/Likely Bugs/Frameworks/JUnit/ExcessivePublicMethodMocking.ql
|
||||
ql/java/ql/src/Likely Bugs/Frameworks/JUnit/JUnit5MissingNestedAnnotation.ql
|
||||
ql/java/ql/src/Likely Bugs/Frameworks/JUnit/MockingAllNonPrivateMethodsMeansUnitTestIsTooBig.ql
|
||||
ql/java/ql/src/Likely Bugs/Inheritance/NoNonFinalInConstructor.ql
|
||||
ql/java/ql/src/Likely Bugs/Likely Typos/ContainerSizeCmpZero.ql
|
||||
ql/java/ql/src/Likely Bugs/Likely Typos/ContradictoryTypeChecks.ql
|
||||
|
||||
@@ -34,8 +34,8 @@ ql/java/ql/src/Likely Bugs/Concurrency/NonSynchronizedOverride.ql
|
||||
ql/java/ql/src/Likely Bugs/Concurrency/ScheduledThreadPoolExecutorZeroThread.ql
|
||||
ql/java/ql/src/Likely Bugs/Concurrency/SynchOnBoxedType.ql
|
||||
ql/java/ql/src/Likely Bugs/Concurrency/SynchSetUnsynchGet.ql
|
||||
ql/java/ql/src/Likely Bugs/Frameworks/JUnit/ExcessivePublicMethodMocking.ql
|
||||
ql/java/ql/src/Likely Bugs/Frameworks/JUnit/JUnit5MissingNestedAnnotation.ql
|
||||
ql/java/ql/src/Likely Bugs/Frameworks/JUnit/MockingAllNonPrivateMethodsMeansUnitTestIsTooBig.ql
|
||||
ql/java/ql/src/Likely Bugs/Inheritance/NoNonFinalInConstructor.ql
|
||||
ql/java/ql/src/Likely Bugs/Likely Typos/ContainerSizeCmpZero.ql
|
||||
ql/java/ql/src/Likely Bugs/Likely Typos/ContradictoryTypeChecks.ql
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
## Overview
|
||||
|
||||
Mocking methods of a class is necessary for unit tests to run without overhead caused by expensive I/O operations. However, when a unit test ends up mocking all non-private methods of a class, it may indicate that the test is too complicated, possibly because it is trying to test multiple things at once. Such extensive mocking is likely a signal that the scope of the unit test is reaching beyond a single unit of functionality.
|
||||
Mocking methods of a class is necessary for unit tests to run without overhead caused by expensive I/O operations. However, when a unit test ends up mocking all public methods of a class, it may indicate that the test is too complicated, possibly because it is trying to test multiple things at once. Such extensive mocking is likely a signal that the scope of the unit test is reaching beyond a single unit of functionality.
|
||||
|
||||
## Recommendation
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
/**
|
||||
* @id java/mocking-all-non-private-methods-means-unit-test-is-too-big
|
||||
* @name Mocking all non-private methods of a class may indicate the unit test is testing too much
|
||||
* @description Mocking all non-private methods provided by a class might indicate the unit test
|
||||
* @id java/excessive-public-method-mocking
|
||||
* @previous-id java/mocking-all-non-private-methods-means-unit-test-is-too-big
|
||||
* @name Mocking all public methods of a class may indicate the unit test is testing too much
|
||||
* @description Mocking all public methods provided by a class might indicate the unit test
|
||||
* aims to test too many things.
|
||||
* @kind problem
|
||||
* @precision high
|
||||
@@ -0,0 +1,2 @@
|
||||
query: Likely Bugs/Frameworks/JUnit/ExcessivePublicMethodMocking.ql
|
||||
postprocess: utils/test/InlineExpectationsTestQuery.ql
|
||||
@@ -1,2 +0,0 @@
|
||||
query: Likely Bugs/Frameworks/JUnit/MockingAllNonPrivateMethodsMeansUnitTestIsTooBig.ql
|
||||
postprocess: utils/test/InlineExpectationsTestQuery.ql
|
||||
Reference in New Issue
Block a user