migrate to the new version of format
[idea/community.git] / python / educational-core / student / testSrc / com / jetbrains / edu / learning / StudyMigrationTest.java
1 package com.jetbrains.edu.learning;
2
3 import com.intellij.openapi.util.JDOMUtil;
4 import com.intellij.openapi.util.io.FileUtil;
5 import com.intellij.testFramework.PlatformTestUtil;
6 import org.jdom.Element;
7 import org.jdom.JDOMException;
8 import org.junit.Test;
9
10 import java.io.File;
11 import java.io.IOException;
12
13 public class StudyMigrationTest {
14
15   @Test
16   public void testFromThirdToForth() throws JDOMException, IOException, StudySerializationUtils.StudyUnrecognizedFormatException {
17     Element element = JDOMUtil.load(new File(FileUtil.join(getTestDataPath(), "3.xml")));
18     Element actual = StudySerializationUtils.Xml.convertToForthVersion(element);
19     Element expected = JDOMUtil.load(new File(FileUtil.join(getTestDataPath()), "4.xml"));
20     PlatformTestUtil.assertElementsEqual(expected, actual);
21   }
22
23   protected String getTestDataPath() {
24     return FileUtil.join(PlatformTestUtil.getCommunityPath(), "python/educational-core/student/testData/migration");
25   }
26 }