void () { myFixture.enableInspections(new ChainedMethodCallInspection()); myFixture.configureByText("Test.java", """ import java.io.File; class X { int foo(File f) { return f.getName().lengt<caret>h(); } } """); IntentionAction action = myFixture.findSingleIntention("Introduce variable"); myFixture.checkPreviewAndLaunchAction(action); myFixture.checkResult(""" import java.io.File; class X { int foo(File f) { String name = f.getName(); return name.length(); } } """); }