public void test_extractExpression() throws Exception { this.addNodeById("1230052684510"); this.addNodeById("1230052684520"); this.addNodeById("1230052684528"); this.addNodeById("1230052684538"); SLinkOperations.setTarget( SNodeOperations.cast( this.getNodeById("1230052684533"), "jetbrains.mps.baseLanguage.structure.StaticMethodCall"), "classConcept", SNodeOperations.cast( this.getNodeById("1230052684539"), "jetbrains.mps.baseLanguage.structure.ClassConcept"), false); SLinkOperations.setTarget( SNodeOperations.cast( this.getNodeById("1230052684533"), "jetbrains.mps.baseLanguage.structure.StaticMethodCall"), "baseMethodDeclaration", SNodeOperations.cast( this.getNodeById("1230052684540"), "jetbrains.mps.baseLanguage.structure.StaticMethodDeclaration"), false); ExtractMethodRefactoringParameters params = ExtractMethodFactory.createParameters( ListSequence.fromListAndArray( new ArrayList<SNode>(), SNodeOperations.cast( this.getNodeById("1230052684515"), "jetbrains.mps.baseLanguage.structure.StringLiteral"))); params.setName("foo"); params.setVisibilityLevel(VisibilityLevel.PUBLIC); ExtractMethodRefactoring ref = ExtractMethodFactory.createRefactoring(params); ref.setStaticContainer( SNodeOperations.cast( this.getNodeById("1230052684521"), "jetbrains.mps.baseLanguage.structure.ClassConcept")); ref.doRefactor(); { List<SNode> nodesBefore = ListSequence.fromListAndArray( new ArrayList<SNode>(), SNodeOperations.cast( this.getNodeById("1230052684511"), "jetbrains.mps.lang.intentions.structure.IntentionDeclaration"), SNodeOperations.cast( this.getNodeById("1230052684521"), "jetbrains.mps.baseLanguage.structure.ClassConcept")); List<SNode> nodesAfter = ListSequence.fromListAndArray( new ArrayList<SNode>(), SNodeOperations.cast( this.getNodeById("1230052684529"), "jetbrains.mps.lang.intentions.structure.IntentionDeclaration"), SNodeOperations.cast( this.getNodeById("1230052684539"), "jetbrains.mps.baseLanguage.structure.ClassConcept")); Assert.assertNull( "nodes '" + nodesBefore + "' and '" + nodesAfter + "' do not match!", NodesMatcher.matchNodes(nodesBefore, nodesAfter)); } }