From 26fc3d3259202ae28e1950d8d3716e6e1e80723a Mon Sep 17 00:00:00 2001 From: Vladimir Krivosheev Date: Wed, 20 Dec 2017 13:33:58 +0100 Subject: [PATCH] cleanup, add Language annotation to highlight code --- .../impl/HeavyIdeaTestFixtureImpl.java | 16 ++------------ .../idea/maven/MavenImportingTestCase.java | 22 +++++-------------- .../jetbrains/idea/maven/MavenTestCase.java | 16 ++------------ 3 files changed, 10 insertions(+), 44 deletions(-) diff --git a/platform/testFramework/src/com/intellij/testFramework/fixtures/impl/HeavyIdeaTestFixtureImpl.java b/platform/testFramework/src/com/intellij/testFramework/fixtures/impl/HeavyIdeaTestFixtureImpl.java index 11fdccfbc99d..bf9b69d267ce 100644 --- a/platform/testFramework/src/com/intellij/testFramework/fixtures/impl/HeavyIdeaTestFixtureImpl.java +++ b/platform/testFramework/src/com/intellij/testFramework/fixtures/impl/HeavyIdeaTestFixtureImpl.java @@ -1,17 +1,5 @@ /* - * Copyright 2000-2016 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. */ package com.intellij.testFramework.fixtures.impl; @@ -205,8 +193,8 @@ class HeavyIdeaTestFixtureImpl extends BaseFixture implements HeavyIdeaTestFixtu } if (LangDataKeys.IDE_VIEW.is(dataId)) { VirtualFile[] contentRoots = ProjectRootManager.getInstance(myProject).getContentRoots(); - final PsiDirectory psiDirectory = PsiManager.getInstance(myProject).findDirectory(contentRoots[0]); if (contentRoots.length > 0) { + final PsiDirectory psiDirectory = PsiManager.getInstance(myProject).findDirectory(contentRoots[0]); return new IdeView() { @Override public void selectElement(PsiElement element) { diff --git a/plugins/maven/src/test/java/org/jetbrains/idea/maven/MavenImportingTestCase.java b/plugins/maven/src/test/java/org/jetbrains/idea/maven/MavenImportingTestCase.java index 71beabeda21d..4c36573a96fb 100644 --- a/plugins/maven/src/test/java/org/jetbrains/idea/maven/MavenImportingTestCase.java +++ b/plugins/maven/src/test/java/org/jetbrains/idea/maven/MavenImportingTestCase.java @@ -1,17 +1,5 @@ /* - * Copyright 2000-2017 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. */ package org.jetbrains.idea.maven; @@ -34,12 +22,14 @@ import com.intellij.openapi.util.SystemInfo; import com.intellij.openapi.util.io.FileUtil; import com.intellij.openapi.util.text.StringUtil; import com.intellij.openapi.vfs.VfsUtil; +import com.intellij.openapi.vfs.VfsUtilCore; import com.intellij.openapi.vfs.VirtualFile; import com.intellij.openapi.vfs.newvfs.impl.VfsRootAccess; import com.intellij.testFramework.IdeaTestUtil; import com.intellij.util.Consumer; import com.intellij.util.PathUtil; import com.intellij.util.ui.UIUtil; +import org.intellij.lang.annotations.Language; import org.jetbrains.annotations.NonNls; import org.jetbrains.annotations.NotNull; import org.jetbrains.idea.maven.execution.*; @@ -112,7 +102,7 @@ public abstract class MavenImportingTestCase extends MavenTestCase { } for (int i = 0; i < expectedRoots.length; i++) { - expectedRoots[i] = VfsUtil.pathToUrl(expectedRoots[i]); + expectedRoots[i] = VfsUtilCore.pathToUrl(expectedRoots[i]); } assertUnorderedPathsAreEqual(actual, Arrays.asList(expectedRoots)); @@ -360,7 +350,7 @@ public abstract class MavenImportingTestCase extends MavenTestCase { private ContentEntry getContentRoot(String moduleName, String path) { for (ContentEntry e : getContentRoots(moduleName)) { - if (e.getUrl().equals(VfsUtil.pathToUrl(path))) return e; + if (e.getUrl().equals(VfsUtilCore.pathToUrl(path))) return e; } throw new AssertionError("content root not found"); } @@ -373,7 +363,7 @@ public abstract class MavenImportingTestCase extends MavenTestCase { return ModuleRootManager.getInstance(getModule(module)); } - protected void importProject(@NonNls String xml) { + protected void importProject(@NotNull @Language("xml") String xml) { createProjectPom(xml); importProject(); } diff --git a/plugins/maven/src/test/java/org/jetbrains/idea/maven/MavenTestCase.java b/plugins/maven/src/test/java/org/jetbrains/idea/maven/MavenTestCase.java index 6af60f6d0b7c..86f4b3b3500a 100644 --- a/plugins/maven/src/test/java/org/jetbrains/idea/maven/MavenTestCase.java +++ b/plugins/maven/src/test/java/org/jetbrains/idea/maven/MavenTestCase.java @@ -1,17 +1,5 @@ /* - * Copyright 2000-2017 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. */ package org.jetbrains.idea.maven; @@ -341,7 +329,7 @@ public abstract class MavenTestCase extends UsefulTestCase { }.execute().getResultObject(); } - protected VirtualFile createProjectPom(@NonNls String xml) { + protected VirtualFile createProjectPom(@NotNull @Language("xml") String xml) { return myProjectPom = createPomFile(myProjectRoot, xml); }