当前位置: 首页>>代码示例>>Java>>正文


Java PlatformTestUtil.assertElementsEqual方法代码示例

本文整理汇总了Java中com.intellij.testFramework.PlatformTestUtil.assertElementsEqual方法的典型用法代码示例。如果您正苦于以下问题:Java PlatformTestUtil.assertElementsEqual方法的具体用法?Java PlatformTestUtil.assertElementsEqual怎么用?Java PlatformTestUtil.assertElementsEqual使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.intellij.testFramework.PlatformTestUtil的用法示例。


在下文中一共展示了PlatformTestUtil.assertElementsEqual方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: doTest

import com.intellij.testFramework.PlatformTestUtil; //导入方法依赖的package包/类
private static void doTest(final String dirName) throws Exception {
  InspectionProfileImpl.INIT_INSPECTIONS = true;
  try {
    final String relativePath = "/inspection/converter/";
    final File projectFile = new File(JavaTestUtil.getJavaTestDataPath() + relativePath + dirName + "/options.ipr");
    for (Element element : JDOMUtil.loadDocument(projectFile).getRootElement().getChildren("component")) {
      if (Comparing.strEqual(element.getAttributeValue("name"), "InspectionProjectProfileManager")) {
        final InspectionProjectProfileManager profileManager = InspectionProjectProfileManager.getInstance(getProject());
        profileManager.loadState(element);

        Element configElement = profileManager.getState();
        final File file = new File(JavaTestUtil.getJavaTestDataPath() + relativePath + dirName + "/options.after.xml");
        PlatformTestUtil.assertElementsEqual(JDOMUtil.loadDocument(file).getRootElement(), configElement);
        break;
      }
    }
  }
  finally {
    InspectionProfileImpl.INIT_INSPECTIONS = false;
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:InspectionProfilesConverterTest.java

示例2: assertOptionsFilesEqual

import com.intellij.testFramework.PlatformTestUtil; //导入方法依赖的package包/类
private void assertOptionsFilesEqual(File originalOptionsDir, File targetOptionsDir, final String fileName) {
  try {
    JpsMacroExpander expander = new JpsMacroExpander(getPathVariables());
    Element expected = JpsLoaderBase.loadRootElement(new File(originalOptionsDir, fileName), expander);
    Element actual = JpsLoaderBase.loadRootElement(new File(targetOptionsDir, fileName), expander);
    PlatformTestUtil.assertElementsEqual(expected, actual);
  }
  catch (IOException e) {
    throw new RuntimeException(e);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:12,代码来源:JpsGlobalSerializationTest.java

示例3: doTestSaveArtifact

import com.intellij.testFramework.PlatformTestUtil; //导入方法依赖的package包/类
private void doTestSaveArtifact(JpsArtifact artifact, File expectedFile) {
  try {
    Element actual = new Element("component").setAttribute("name", "ArtifactManager");
    JpsArtifactSerializer.saveArtifact(artifact, actual);
    JpsMacroExpander
      expander = JpsProjectLoader.createProjectMacroExpander(Collections.<String, String>emptyMap(), new File(getTestDataFileAbsolutePath(SAMPLE_PROJECT_PATH)));
    Element expected = JpsLoaderBase.loadRootElement(expectedFile, expander);
    PlatformTestUtil.assertElementsEqual(expected, actual);
  }
  catch (IOException e) {
    throw new RuntimeException(e);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:14,代码来源:JpsArtifactSerializationTest.java

示例4: doTestSaveLibrary

import com.intellij.testFramework.PlatformTestUtil; //导入方法依赖的package包/类
private void doTestSaveLibrary(File libFile, String libName, JpsLibrary library) {
  try {
    Element actual = new Element("library");
    JpsLibraryTableSerializer.saveLibrary(library, actual, libName);
    JpsMacroExpander
      macroExpander = JpsProjectLoader.createProjectMacroExpander(Collections.<String, String>emptyMap(), getFileInSampleProject(""));
    Element rootElement = JpsLoaderBase.loadRootElement(libFile, macroExpander);
    Element expected = rootElement.getChild("library");
    PlatformTestUtil.assertElementsEqual(expected, actual);
  }
  catch (IOException e) {
    throw new RuntimeException(e);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:15,代码来源:JpsProjectSerializationTest.java

示例5: doTestSaveModule

import com.intellij.testFramework.PlatformTestUtil; //导入方法依赖的package包/类
private void doTestSaveModule(JpsModule module, final String moduleFilePath) {
  try {
    Element actual = JDomSerializationUtil.createComponentElement("NewModuleRootManager");
    JpsModuleRootModelSerializer.saveRootModel(module, actual);
    File imlFile = new File(getTestDataFileAbsolutePath(moduleFilePath));
    Element rootElement = loadModuleRootTag(imlFile);
    Element expected = JDomSerializationUtil.findComponent(rootElement, "NewModuleRootManager");
    PlatformTestUtil.assertElementsEqual(expected, actual);
  }
  catch (Exception e) {
    throw new RuntimeException(e);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:14,代码来源:JpsProjectSerializationTest.java

示例6: doTest

import com.intellij.testFramework.PlatformTestUtil; //导入方法依赖的package包/类
protected static void doTest(final String relativePath, final Project project) throws Exception {
  final String path = project.getBaseDir().getPath() + relativePath;

  final File classpathFile = new File(path, EclipseXml.DOT_CLASSPATH_EXT);
  String fileText = FileUtil.loadFile(classpathFile).replaceAll("\\$ROOT\\$", project.getBaseDir().getPath());
  if (!SystemInfo.isWindows) {
    fileText = fileText.replaceAll(EclipseXml.FILE_PROTOCOL + "/", EclipseXml.FILE_PROTOCOL);
  }
  String communityLib = FileUtil.toSystemIndependentName(PathManagerEx.findFileUnderCommunityHome("lib").getAbsolutePath());
  fileText = fileText.replaceAll("\\$" + JUNIT + "\\$", communityLib);
  final Element classpathElement = JDOMUtil.loadDocument(fileText).getRootElement();
  final Module module = WriteCommandAction.runWriteCommandAction(null, new Computable<Module>() {
    @Override
    public Module compute() {
      return ModuleManager.getInstance(project)
        .newModule(new File(path) + File.separator + EclipseProjectFinder
          .findProjectName(path) + IdeaXml.IML_EXT, StdModuleTypes.JAVA.getId());
    }
  });
  final ModifiableRootModel rootModel = ModuleRootManager.getInstance(module).getModifiableModel();
  EclipseClasspathReader classpathReader = new EclipseClasspathReader(path, project, null);
  classpathReader.init(rootModel);
  classpathReader.readClasspath(rootModel, classpathElement);
  ApplicationManager.getApplication().runWriteAction(new Runnable() {
    public void run() {
      rootModel.commit();
    }
  });

  final Element actualImlElement = new Element("root");
  ((ModuleRootManagerImpl)ModuleRootManager.getInstance(module)).getState().writeExternal(actualImlElement);

  PathMacros.getInstance().setMacro(JUNIT, communityLib);
  PathMacroManager.getInstance(module).collapsePaths(actualImlElement);
  PathMacroManager.getInstance(project).collapsePaths(actualImlElement);
  PathMacros.getInstance().removeMacro(JUNIT);

  final Element expectedIml =
    JDOMUtil.loadDocument(new File(project.getBaseDir().getPath() + "/expected", "expected.iml")).getRootElement();
  PlatformTestUtil.assertElementsEqual(expectedIml, actualImlElement);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:42,代码来源:EclipseImlTest.java


注:本文中的com.intellij.testFramework.PlatformTestUtil.assertElementsEqual方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。