File tree Expand file tree Collapse file tree 2 files changed +4
-3
lines changed
java/ql/test/query-tests/MockingAllNonPrivateMethodsMeansUnitTestIsTooBig Expand file tree Collapse file tree 2 files changed +4
-3
lines changed Original file line number Diff line number Diff line change 1
- Likely Bugs/Frameworks/JUnit/MockingAllNonPrivateMethodsMeansUnitTestIsTooBig.ql
1
+ query: Likely Bugs/Frameworks/JUnit/MockingAllNonPrivateMethodsMeansUnitTestIsTooBig.ql
2
+ postprocess: utils/test/InlineExpectationsTestQuery.ql
Original file line number Diff line number Diff line change @@ -31,7 +31,7 @@ public void compliant2() {
31
31
* Test of form `when(mockedObject.methodToBeMocked()).thenReturn(someVal)`.
32
32
*/
33
33
@ Test
34
- public void nonCompliant1 () {
34
+ public void nonCompliant1 () { // $ Alert
35
35
Employee sampleEmployee = new Employee ("John Doe" );
36
36
EmployeeRecord employeeRecordMock = mock (EmployeeRecord .class ); // NON_COMPLIANT: All public methods of the mocked object are used
37
37
when (employeeRecordMock .add (sampleEmployee )).thenReturn (0 ); // Mocked EmployeeRecord.add
@@ -44,7 +44,7 @@ public void nonCompliant1() {
44
44
* Test of form `doReturn(someVal).when(mockedObject).methodToBeMocked()`.
45
45
*/
46
46
@ Test
47
- public void nonCompliant2 () {
47
+ public void nonCompliant2 () { // $ Alert
48
48
Employee sampleEmployee = new Employee ("John Doe" );
49
49
EmployeeRecord employeeRecordMock = mock (EmployeeRecord .class ); // NON_COMPLIANT: All public methods of the mocked object are used
50
50
doReturn (0 ).when (employeeRecordMock ).add (sampleEmployee ); // Mocked EmployeeRecord.add
You can’t perform that action at this time.
0 commit comments