use of com.intellij.psi.codeStyle.arrangement.std.StdArrangementSettings in project intellij-community by JetBrains.
the class ArrangementSettingsSerializationTest method doSerializationTest.
private static Element doSerializationTest(@NotNull StdArrangementSettings settings, @NotNull StdArrangementSettings defaultSettings) {
Element holder = new Element("holder");
ArrangementSettingsSerializer instance = new TestArrangementSettingsSerializer(defaultSettings);
instance.serialize(settings, holder);
ArrangementSettings restored = instance.deserialize(holder);
assertEquals(settings, restored);
return holder;
}
use of com.intellij.psi.codeStyle.arrangement.std.StdArrangementSettings in project intellij-community by JetBrains.
the class ArrangementSettingsSerializationTest method testSimpleSectionSerialize.
@Test
public void testSimpleSectionSerialize() {
final StdArrangementSettings settings = settings(ContainerUtil.newArrayList(group(OVERRIDDEN_METHODS)), ContainerUtil.newArrayList(section(true, FIELD)));
final Element holder = doSerializationTest(settings, emptySettings());
assertTrue(holder.getChildren().size() == 2);
assertNotNull(holder.getChild("groups"));
final Element rules = holder.getChild("rules");
assertNotNull(rules);
assertTrue(rules.getChildren().size() == 1);
final Element section = rules.getChild("section");
assertNotNull(section);
assertTrue(section.getChildren().size() == 1);
assertNotNull(section.getChild("rule"));
}
use of com.intellij.psi.codeStyle.arrangement.std.StdArrangementSettings in project intellij-community by JetBrains.
the class ArrangementSettingsSerializationTest method testDefaultGroupingFilter.
@Test
public void testDefaultGroupingFilter() {
final ArrangementGroupingRule groupingRule = new ArrangementGroupingRule(OVERRIDDEN_METHODS, BY_NAME);
final ArrangementAtomMatchCondition condition = new ArrangementAtomMatchCondition(FIELD);
final StdArrangementMatchRule rule = new StdArrangementMatchRule(new StdArrangementEntryMatcher(condition), BY_NAME);
final StdArrangementSettings settings = new StdArrangementSettings();
settings.addGrouping(groupingRule);
settings.addRule(rule);
final StdArrangementSettings defaultSettings = new StdArrangementSettings();
defaultSettings.addGrouping(groupingRule);
final Element holder = doSerializationTest(settings, defaultSettings);
assertTrue(holder.getChildren().size() == 1);
assertNull(holder.getChild("groups"));
assertNotNull(holder.getChild("rules"));
}
use of com.intellij.psi.codeStyle.arrangement.std.StdArrangementSettings in project intellij-community by JetBrains.
the class ArrangementSettingsSerializationTest method testEmptyRules.
@Test
public void testEmptyRules() throws Exception {
final StdArrangementSettings settings = new StdArrangementSettings();
settings.addGrouping(new ArrangementGroupingRule(OVERRIDDEN_METHODS, BY_NAME));
final StdArrangementSettings defaultSettings = new StdArrangementSettings();
final ArrangementAtomMatchCondition condition = new ArrangementAtomMatchCondition(FIELD);
final StdArrangementMatchRule rule = new StdArrangementMatchRule(new StdArrangementEntryMatcher(condition), BY_NAME);
defaultSettings.addRule(rule);
final Element holder = doSerializationTest(settings, defaultSettings);
assertTrue(holder.getChildren().size() == 2);
final Element rules = holder.getChild("rules");
assertNotNull(rules);
assertTrue(rules.getChildren().isEmpty());
}
Aggregations