File tree Expand file tree Collapse file tree
java/ql/test/query-tests/MockingAllNonPrivateMethodsMeansUnitTestIsTooBig Expand file tree Collapse file tree 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() {
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
You can’t perform that action at this time.
0 commit comments