Skip to content

Commit 29b4466

Browse files
committed
Java: Add inline test expectations for MockingAllNonPrivateMethodsMeansUnitTestIsTooBig.qlref
1 parent fee884f commit 29b4466

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
Likely Bugs/Frameworks/JUnit/MockingAllNonPrivateMethodsMeansUnitTestIsTooBig.ql
1+
query: Likely Bugs/Frameworks/JUnit/MockingAllNonPrivateMethodsMeansUnitTestIsTooBig.ql
2+
postprocess: utils/test/InlineExpectationsTestQuery.ql

java/ql/test/query-tests/MockingAllNonPrivateMethodsMeansUnitTestIsTooBig/TestORM.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public void compliant2() {
3131
* Test of form `when(mockedObject.methodToBeMocked()).thenReturn(someVal)`.
3232
*/
3333
@Test
34-
public void nonCompliant1() {
34+
public void nonCompliant1() { // $ Alert
3535
Employee sampleEmployee = new Employee("John Doe");
3636
EmployeeRecord employeeRecordMock = mock(EmployeeRecord.class); // NON_COMPLIANT: All public methods of the mocked object are used
3737
when(employeeRecordMock.add(sampleEmployee)).thenReturn(0); // Mocked EmployeeRecord.add
@@ -44,7 +44,7 @@ public void nonCompliant1() {
4444
* Test of form `doReturn(someVal).when(mockedObject).methodToBeMocked()`.
4545
*/
4646
@Test
47-
public void nonCompliant2() {
47+
public void nonCompliant2() { // $ Alert
4848
Employee sampleEmployee = new Employee("John Doe");
4949
EmployeeRecord employeeRecordMock = mock(EmployeeRecord.class); // NON_COMPLIANT: All public methods of the mocked object are used
5050
doReturn(0).when(employeeRecordMock).add(sampleEmployee); // Mocked EmployeeRecord.add

0 commit comments

Comments
 (0)