void (String className) { GlobalSearchScope scope = GlobalSearchScope.moduleWithLibrariesScope(getModule()); PsiClass psiClass = JavaPsiFacade.getInstance(getProject()).findClass(PACKAGE_NAME + '.' + className, scope); assertNotNull(psiClass); ProjectBytecodeAnalysis service = ProjectBytecodeAnalysis.getInstance(getProject()); for (PsiMethod method : psiClass.getMethods()) { PsiParameter[] parameters = method.getParameterList().getParameters(); if (method.isConstructor() && parameters.length == 0) continue; for (int i = 0; i < parameters.length; i++) { boolean expectNotNull = AnnotationUtil.isAnnotated(parameters[i], EXPECT_NOT_NULL, 0); PsiAnnotation inferredAnnotation = service.findInferredAnnotation(parameters[i], AnnotationUtil.NOT_NULL); assertNullity(displayName(method) + "/arg#" + i, expectNotNull, inferredAnnotation); } boolean expectNotNull = AnnotationUtil.isAnnotated(method, EXPECT_NOT_NULL, 0); PsiAnnotation actualAnnotation = service.findInferredAnnotation(method, AnnotationUtil.NOT_NULL); assertNullity(displayName(method), expectNotNull, actualAnnotation); PsiAnnotation expectedContract = AnnotationUtil.findAnnotation(method, EXPECT_CONTRACT); PsiAnnotation actualContract = service.findInferredAnnotation(method, Contract.class.getName()); String expectedText = contractText(expectedContract); String inferredText = contractText(actualContract); assertEquals(displayName(method) + ":" + expectedText + " <> " + inferredText, expectedText, inferredText); } for (PsiField field : psiClass.getFields()) { boolean expectNotNull = AnnotationUtil.isAnnotated(field, EXPECT_NOT_NULL, 0); PsiAnnotation actualAnnotation = service.findInferredAnnotation(field, AnnotationUtil.NOT_NULL); assertNullity(displayName(field), expectNotNull, actualAnnotation); } }