Tor Norbye | c667c1f | 2014-05-28 17:06:51 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2000-2014 JetBrains s.r.o. |
| 3 | * |
| 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 |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 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. |
| 15 | */ |
| 16 | package org.jetbrains.idea.devkit.inspections; |
| 17 | |
| 18 | import com.intellij.codeInspection.deadCode.UnusedDeclarationInspection; |
| 19 | import com.intellij.codeInspection.unusedSymbol.UnusedSymbolLocalInspection; |
| 20 | import com.intellij.openapi.application.PluginPathManager; |
| 21 | import com.intellij.testFramework.TestDataPath; |
| 22 | import com.intellij.testFramework.fixtures.LightCodeInsightFixtureTestCase; |
Tor Norbye | c3d3a90f | 2014-09-04 13:24:04 -0700 | [diff] [blame] | 23 | import com.siyeh.ig.inheritance.AbstractClassNeverImplementedInspection; |
Tor Norbye | c667c1f | 2014-05-28 17:06:51 -0700 | [diff] [blame] | 24 | |
| 25 | @TestDataPath("$CONTENT_ROOT/testData/inspections/implicitUsage") |
| 26 | public class DevKitImplicitUsageProviderTest extends LightCodeInsightFixtureTestCase { |
| 27 | |
| 28 | @Override |
| 29 | protected String getBasePath() { |
| 30 | return PluginPathManager.getPluginHomePathRelative("devkit") + "/testData/inspections/implicitUsage"; |
| 31 | } |
| 32 | |
| 33 | @Override |
| 34 | protected void setUp() throws Exception { |
| 35 | super.setUp(); |
| 36 | |
| 37 | myFixture.addClass("package com.intellij.util.xml; public interface DomElement {}"); |
| 38 | myFixture.addClass("package com.intellij.util.xml; public interface DomElementVisitor {}"); |
| 39 | myFixture.addClass("package com.intellij.util.xml; public interface GenericAttributeValue<T> extends DomElement {}"); |
| 40 | |
Tor Norbye | c3d3a90f | 2014-09-04 13:24:04 -0700 | [diff] [blame] | 41 | myFixture.addClass("package com.intellij.jam; public interface JamElement {}"); |
Tor Norbye | c667c1f | 2014-05-28 17:06:51 -0700 | [diff] [blame] | 42 | } |
| 43 | |
| 44 | public void testImplicitUsagesDomElement() { |
Tor Norbye | c3d3a90f | 2014-09-04 13:24:04 -0700 | [diff] [blame] | 45 | enableImplicitUsageInspections(); |
Tor Norbye | c667c1f | 2014-05-28 17:06:51 -0700 | [diff] [blame] | 46 | myFixture.testHighlighting("ImplicitUsagesDomElement.java"); |
| 47 | } |
| 48 | |
| 49 | public void testImplicitUsagesDomElementVisitor() { |
Tor Norbye | c3d3a90f | 2014-09-04 13:24:04 -0700 | [diff] [blame] | 50 | enableImplicitUsageInspections(); |
Tor Norbye | c667c1f | 2014-05-28 17:06:51 -0700 | [diff] [blame] | 51 | myFixture.testHighlighting("ImplicitUsagesDomElementVisitor.java"); |
| 52 | } |
Tor Norbye | c3d3a90f | 2014-09-04 13:24:04 -0700 | [diff] [blame] | 53 | |
| 54 | private void enableImplicitUsageInspections() { |
| 55 | myFixture.enableInspections(new UnusedSymbolLocalInspection(), new UnusedDeclarationInspection()); |
| 56 | } |
| 57 | |
| 58 | |
| 59 | public void testImplementedAtRuntimeDomElementImpl() { |
| 60 | enableImplementedAtRuntimeInspections(); |
| 61 | myFixture.testHighlighting("ImplementedAtRuntimeDomElementImpl.java"); |
| 62 | } |
| 63 | |
| 64 | public void testImplementedAtRuntimeJamElementImpl() { |
| 65 | enableImplementedAtRuntimeInspections(); |
| 66 | myFixture.testHighlighting("ImplementedAtRuntimeJamElementImpl.java"); |
| 67 | } |
| 68 | |
| 69 | private void enableImplementedAtRuntimeInspections() { |
| 70 | myFixture.enableInspections(new AbstractClassNeverImplementedInspection()); |
| 71 | } |
Tor Norbye | c667c1f | 2014-05-28 17:06:51 -0700 | [diff] [blame] | 72 | } |