package jetbrains.mps.refactoringTest; /*Generated by MPS */ import jetbrains.mps.MPSLaunch; import jetbrains.mps.lang.test.runtime.BaseTransformationTest; import org.junit.Test; import jetbrains.mps.lang.test.runtime.BaseTestBody; import jetbrains.mps.baseLanguage.util.plugin.refactorings.IntroduceConstantRefactoring; import jetbrains.mps.lang.smodel.generator.smodelAdapter.SNodeOperations; import jetbrains.mps.smodel.adapter.structure.MetaAdapterFactory; import jetbrains.mps.baseLanguage.util.plugin.refactorings.VisibilityLevel; import java.util.List; import org.jetbrains.mps.openapi.model.SNode; import jetbrains.mps.internal.collections.runtime.ListSequence; import java.util.ArrayList; import junit.framework.Assert; import jetbrains.mps.lang.test.matcher.NodesMatcher; @MPSLaunch public class SimpleFindForIntroduceConstant_Test extends BaseTransformationTest { @Test public void test_SimpleFindForIntroduceConstantTest() throws Throwable { initTest("${mps_home}", "r:4dc6ffb5-4bbb-4773-b0b7-e52989ceb56f(jetbrains.mps.refactoringTest@tests)", false); runTest("jetbrains.mps.refactoringTest.SimpleFindForIntroduceConstant_Test$TestBody", "test_SimpleFindForIntroduceConstantTest", true); } @MPSLaunch public static class TestBody extends BaseTestBody { public void test_SimpleFindForIntroduceConstantTest() throws Exception { addNodeById("7568753874916187326"); addNodeById("7568753874916187364"); IntroduceConstantRefactoring refactoring = new IntroduceConstantRefactoring(); refactoring.init(SNodeOperations.cast(getNodeById("7568753874916187344"), SNodeOperations.asSConcept(MetaAdapterFactory.getConcept(MetaAdapterFactory.getLanguage(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, "jetbrains.mps.baseLanguage"), 0xf93d565d10L, "StringLiteral"))), null); refactoring.setName("s"); refactoring.setReplacingAll(true); refactoring.setVisibilityLevel(VisibilityLevel.PRIVATE); refactoring.doRefactoring(); { List<SNode> nodesBefore = ListSequence.fromListAndArray(new ArrayList<SNode>(), SNodeOperations.cast(getNodeById("7568753874916187327"), SNodeOperations.asSConcept(MetaAdapterFactory.getConcept(MetaAdapterFactory.getLanguage(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, "jetbrains.mps.baseLanguage"), 0xf8c108ca66L, "ClassConcept")))); List<SNode> nodesAfter = ListSequence.fromListAndArray(new ArrayList<SNode>(), SNodeOperations.cast(getNodeById("7568753874916187375"), SNodeOperations.asSConcept(MetaAdapterFactory.getConcept(MetaAdapterFactory.getLanguage(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, "jetbrains.mps.baseLanguage"), 0xf8c108ca66L, "ClassConcept")))); Assert.assertNull("The nodes '" + nodesBefore + "' and '" + nodesAfter + "' do not match!", new NodesMatcher().match(nodesBefore, nodesAfter)); } } } }