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.
29 public abstract class TestBase
extends TestCase
{
30 protected CodeInsightTestFixture myFixture
;
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());
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();
52 protected void tearDown() throws Exception
{
56 protected String
getTestFileName() {
57 final String s
= getName().substring("test".length());
58 return Character
.toLowerCase(s
.charAt(0)) + s
.substring(1);