aboutsummaryrefslogtreecommitdiffstats
path: root/integration/intellij/src/test/java/ai/vespa/intellij/PluginTestBase.java
blob: c4edeac36057deb98b6ef38306addba35121241e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package ai.vespa.intellij;

import com.intellij.testFramework.LightProjectDescriptor;
import com.intellij.testFramework.fixtures.LightJavaCodeInsightFixtureTestCase;
import org.junit.Test;

/**
 * Parent of unit tests. This is an antipattern, but mandated by IntelliJ.
 *
 * NOTE: Sometimes, unit tests will stop working with IntelliJ-interna. exceptions. To fix this,
 *       run the first step of "File -> Repair IDE": "Refresh indexable files"
 *
 * @author bratseth
 */
public class PluginTestBase extends LightJavaCodeInsightFixtureTestCase {

    private final TestProjectDescriptor descriptor;

    public PluginTestBase() {
        descriptor = new TestProjectDescriptor(); // Expensive instance
    }

    @Override
    protected LightProjectDescriptor getProjectDescriptor() { return descriptor; }

    @Override
    protected String getTestDataPath() { return "."; }

    protected void useDir(String dir) {
        myFixture.copyDirectoryToProject(dir, "/");
    }

    /** Avoid "no tests" warning */
    @Test
    public void testDummy() {}

    static class TestProjectDescriptor extends LightProjectDescriptor {

    }

}