void () { CommonCodeStyleSettings settings = CodeStyle.getSettings(getProject()).getCommonSettings(JavaLanguage.INSTANCE); boolean old = settings.ALIGN_GROUP_FIELD_DECLARATIONS; settings.ALIGN_GROUP_FIELD_DECLARATIONS = true; try { myFixture.configureByText("Tq.java", """ class Tq { private Li<caret>st<String> test = null; private String varA = "AAA"; private String varBLonger = "BBB"; public String getA () { return varA; } public String getVarBLonger() { return varBLonger; } } """); importClass(); myFixture.checkResult( """ import java.util.List; class Tq { private List<String> test = null; private String varA = "AAA"; private String varBLonger = "BBB"; public String getA () { return varA; } public String getVarBLonger() { return varBLonger; } } """); } finally { settings.ALIGN_GROUP_FIELD_DECLARATIONS = old; } }