2 * Copyright 2000-2016 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.jetbrains.references
18 import com.intellij.openapi.application.ex.PathManagerEx
19 import com.intellij.openapi.util.io.FileUtil
21 class ReferenceIndexTest : ReferenceIndexTestBase() {
22 override fun getTestDataRootPath(): String {
23 return FileUtil.toCanonicalPath(PathManagerEx.findFileUnderCommunityHome("jps/jps-builders/testData/referencesIndex").absolutePath, '/')
26 fun testIncrementalIndexUpdate() {
27 assertIndexOnRebuild("Bar.java", "Foo.java", "FooImpl.java")
28 changeFileContent("Bar.java", "Bar_1.java")
30 assertIndexEquals("afterMakeIndex.txt")
31 changeFileContent("FooImpl.java", "FooImpl_2.java")
33 assertIndexEquals("afterSecondMakeIndex.txt")
36 fun testFileCaseOnlyRename() {
37 assertIndexOnRebuild("Bar.java")
38 renameFile("Bar.java", "bar.java")
40 assertIndexEquals("afterRename.txt")
43 fun testUnusedImports() {
44 assertIndexOnRebuild("Bar.java")
47 fun testUnusedImports2() {
48 assertIndexOnRebuild("Main.java",
55 assertIndexOnRebuild("Bar.java")
58 fun testPackageInfo() {
59 assertIndexOnRebuild("myPackage/package-info.java")
63 assertIndexOnRebuild("Array.java", "Foo.java", "Bar.java")
66 fun testTypeParameterRefs() {
67 assertIndexOnRebuild("TypeParam.java")
71 assertIndexOnRebuild("Anonymous.java")
74 fun testPrivateMembers() {
75 assertIndexOnRebuild("PrivateMembers.java")