Skip to content

Commit b271f1f

Browse files
committed
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
1 parent ff648fc commit b271f1f

File tree

12 files changed

+9
-8
lines changed

12 files changed

+9
-8
lines changed

java/ql/integration-tests/java/query-suite/java-code-quality-extended.qls.expected

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ ql/java/ql/src/Likely Bugs/Concurrency/NonSynchronizedOverride.ql
3636
ql/java/ql/src/Likely Bugs/Concurrency/ScheduledThreadPoolExecutorZeroThread.ql
3737
ql/java/ql/src/Likely Bugs/Concurrency/SynchOnBoxedType.ql
3838
ql/java/ql/src/Likely Bugs/Concurrency/SynchSetUnsynchGet.ql
39+
ql/java/ql/src/Likely Bugs/Frameworks/JUnit/ExcessivePublicMethodMocking.ql
3940
ql/java/ql/src/Likely Bugs/Frameworks/JUnit/JUnit5MissingNestedAnnotation.ql
40-
ql/java/ql/src/Likely Bugs/Frameworks/JUnit/MockingAllNonPrivateMethodsMeansUnitTestIsTooBig.ql
4141
ql/java/ql/src/Likely Bugs/Inheritance/NoNonFinalInConstructor.ql
4242
ql/java/ql/src/Likely Bugs/Likely Typos/ContainerSizeCmpZero.ql
4343
ql/java/ql/src/Likely Bugs/Likely Typos/ContradictoryTypeChecks.ql

java/ql/integration-tests/java/query-suite/java-code-quality.qls.expected

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ ql/java/ql/src/Likely Bugs/Concurrency/NonSynchronizedOverride.ql
3434
ql/java/ql/src/Likely Bugs/Concurrency/ScheduledThreadPoolExecutorZeroThread.ql
3535
ql/java/ql/src/Likely Bugs/Concurrency/SynchOnBoxedType.ql
3636
ql/java/ql/src/Likely Bugs/Concurrency/SynchSetUnsynchGet.ql
37+
ql/java/ql/src/Likely Bugs/Frameworks/JUnit/ExcessivePublicMethodMocking.ql
3738
ql/java/ql/src/Likely Bugs/Frameworks/JUnit/JUnit5MissingNestedAnnotation.ql
38-
ql/java/ql/src/Likely Bugs/Frameworks/JUnit/MockingAllNonPrivateMethodsMeansUnitTestIsTooBig.ql
3939
ql/java/ql/src/Likely Bugs/Inheritance/NoNonFinalInConstructor.ql
4040
ql/java/ql/src/Likely Bugs/Likely Typos/ContainerSizeCmpZero.ql
4141
ql/java/ql/src/Likely Bugs/Likely Typos/ContradictoryTypeChecks.ql
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
## Overview
22

3-
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.
3+
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.
44

55
## Recommendation
66

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
/**
2-
* @id java/mocking-all-non-private-methods-means-unit-test-is-too-big
3-
* @name Mocking all non-private methods of a class may indicate the unit test is testing too much
4-
* @description Mocking all non-private methods provided by a class might indicate the unit test
2+
* @id java/excessive-public-method-mocking
3+
* @previous-id java/mocking-all-non-private-methods-means-unit-test-is-too-big
4+
* @name Mocking all public methods of a class may indicate the unit test is testing too much
5+
* @description Mocking all public methods provided by a class might indicate the unit test
56
* aims to test too many things.
67
* @kind problem
78
* @precision high
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
query: Likely Bugs/Frameworks/JUnit/ExcessivePublicMethodMocking.ql
2+
postprocess: utils/test/InlineExpectationsTestQuery.ql

0 commit comments

Comments
 (0)