File tree Expand file tree Collapse file tree 1 file changed +9
-3
lines changed
utbot-framework/src/main/kotlin/org/utbot/engine Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -203,12 +203,18 @@ class Mocker(
203203 return false
204204 }
205205
206+ val sootField = sootDeclaringClass.getFieldByName(mockInfo.fieldId.name)
207+ val sootFieldType = sootField.type
208+
206209 return when {
207- declaringClass .packageName.startsWith(" java.lang" ) -> false
208- ! mockInfo.fieldId.type.isRefType -> false // mocks are allowed for ref fields only
209- else -> return strategy.eligibleToMock(mockInfo.fieldId.type , classUnderTest) // if we have a field with Integer type, we should not mock it
210+ sootDeclaringClass .packageName.startsWith(" java.lang" ) -> false
211+ sootFieldType !is RefType -> false // mocks are allowed for ref fields only
212+ else -> strategy.eligibleToMock(sootFieldType.id , classUnderTest) // if we have a field with Integer type, we should not mock it
210213 }
211214 }
215+
216+ // Note that eligibleToMock can use information retrieved from jClass
217+ // Therefore, such classes should be already processed at this point
212218 return strategy.eligibleToMock(type.id, classUnderTest) // strategy to decide
213219 }
214220
You can’t perform that action at this time.
0 commit comments