void (String expected, String classBody) { PsiClass clazz = myFixture.addClass("final class Foo { " + classBody + " }"); assertFalse(((PsiFileImpl)clazz.getContainingFile()).isContentsLoaded()); PsiMethodImpl method = (PsiMethodImpl)clazz.getMethods()[0]; String actual = StreamEx.of(method.getParameterList().getParameters()) .map(JavaSourceInference::inferNullability) .map(n -> n == Nullability.NOT_NULL ? "+" : "-") .joining(); assertFalse(((PsiFileImpl)clazz.getContainingFile()).isContentsLoaded()); assertEquals(expected, actual); }