update copyright
[fedora-idea.git] / plugins / xpath / xpath-lang / test / org / intellij / lang / xpath / TestBase.java
blobb86a49810794e41643d8a39d6356f99ec229cc70
1 /*
2 * Copyright 2000-2009 JetBrains s.r.o.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
16 package org.intellij.lang.xpath;
18 import com.intellij.openapi.application.PluginPathManager;
19 import com.intellij.testFramework.fixtures.CodeInsightTestFixture;
20 import com.intellij.testFramework.fixtures.IdeaProjectTestFixture;
21 import com.intellij.testFramework.fixtures.JavaTestFixtureFactory;
22 import junit.framework.TestCase;
25 * Created by IntelliJ IDEA.
26 * User: sweinreuter
27 * Date: 17.12.2008
29 public abstract class TestBase extends TestCase {
30 protected CodeInsightTestFixture myFixture;
32 @Override
33 protected void setUp() throws Exception {
34 final JavaTestFixtureFactory factory = JavaTestFixtureFactory.getFixtureFactory();
35 final IdeaProjectTestFixture fixture = factory.createLightFixtureBuilder().getFixture();
36 myFixture = factory.createCodeInsightFixture(fixture);
38 myFixture.setTestDataPath(getTestDataPath());
40 myFixture.setUp();
43 private String getTestDataPath() {
44 // path logic taken from RegExpSupport tests
45 final String def = PluginPathManager.getPluginHomePath("xpath") + "/xpath-lang/testData";
46 return System.getProperty("idea.xpath.testdata-path", def) + "/" + getSubPath();
49 protected abstract String getSubPath();
51 @Override
52 protected void tearDown() throws Exception {
53 myFixture.tearDown();
56 protected String getTestFileName() {
57 final String s = getName().substring("test".length());
58 return Character.toLowerCase(s.charAt(0)) + s.substring(1);