void (LanguageLevel level) { configureByFile(getTestName(false) + ".java"); doHighlighting(); List<IntentionAction> actions = CodeInsightTestFixtureImpl.getAvailableIntentions(getEditor(), getFile()); String message = JavaBundle.message("set.language.level.to.0", level.getPresentableText()); IntentionAction foundAction = ContainerUtil.find(actions, act -> act.getText().equals(message)); if (foundAction == null) { LanguageLevel foundLevel = Stream.of(LanguageLevel.values()) .filter(l -> ContainerUtil.exists(actions, act -> act.getText() .equals(JavaBundle.message("set.language.level.to.0", l.getPresentableText())))) .findFirst().orElse(null); if (foundLevel != null) { fail("Expected level: "+level+"; actual: "+foundLevel); } else { fail("Action " + message + " not found"); } } else { String actualPreview = IntentionPreviewPopupUpdateProcessor.getPreviewContent(getProject(), foundAction, getFile(), getEditor()); JavaVersion javaVersion = level.toJavaVersion(); String expectedPreview = JavaBundle.message("increase.language.level.preview.description", getModule().getName(), javaVersion); if (!expectedPreview.equals(actualPreview)) { failNotEquals(foundAction.getText(), expectedPreview, actualPreview); } } }