Cleanup (moves test-only method to tests)

This commit is contained in:
Roman Shevchenko
2018-04-05 19:58:09 +02:00
parent e1d771b14e
commit 6489a5c657
4 changed files with 12 additions and 26 deletions
@@ -10,7 +10,6 @@ import com.intellij.util.lang.JavaVersion;
import org.jetbrains.annotations.Nls;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.annotations.TestOnly;
/**
* Represents a language level (i.e. features available) of a Java code.
@@ -47,12 +46,6 @@ public enum LanguageLevel {
return this == JDK_X ? "Java X" : "Java " + JavaSdkVersion.fromLanguageLevel(this).getDescription();
}
@TestOnly
public static LanguageLevel getHighestRegistered() {
LanguageLevel[] values = values();
return values[values.length - 1];
}
@NotNull
@Nls
public String getPresentableText() {
@@ -1,6 +1,7 @@
// Copyright 2000-2018 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.java.parser;
import com.intellij.JavaTestUtil;
import com.intellij.ide.highlighter.JavaFileType;
import com.intellij.lang.ASTNode;
import com.intellij.lang.LanguageASTFactory;
@@ -37,7 +38,7 @@ public abstract class JavaParsingTestCase extends ParsingTestCase {
@Override
protected void setUp() throws Exception {
super.setUp();
myLanguageLevel = LanguageLevel.getHighestRegistered();
myLanguageLevel = JavaTestUtil.getMaxRegisteredLanguageLevel();
getProject().registerService(LanguageLevelProjectExtension.class, new LanguageLevelProjectExtensionImpl(getProject()));
addExplicitExtension(LanguageASTFactory.INSTANCE, JavaLanguage.INSTANCE, new JavaASTFactory());
}
@@ -1,8 +1,8 @@
// 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.
// Copyright 2000-2018 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.java.psi.formatter.java;
import com.intellij.JavaTestUtil;
import com.intellij.openapi.roots.LanguageLevelProjectExtension;
import com.intellij.pom.java.LanguageLevel;
import com.intellij.psi.codeStyle.CommonCodeStyleSettings;
import com.intellij.testFramework.LightPlatformTestCase;
@@ -16,7 +16,7 @@ public class JavaFormatterSpaceTest extends AbstractJavaFormatterTest {
@Override
protected void setUp() throws Exception {
super.setUp();
LanguageLevelProjectExtension.getInstance(LightPlatformTestCase.getProject()).setLanguageLevel(LanguageLevel.getHighestRegistered());
LanguageLevelProjectExtension.getInstance(LightPlatformTestCase.getProject()).setLanguageLevel(JavaTestUtil.getMaxRegisteredLanguageLevel());
}
public void testSpacingBetweenTypeParameters() {
@@ -1,18 +1,4 @@
/*
* Copyright 2000-2015 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-2018 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;
import com.intellij.openapi.Disposable;
@@ -24,6 +10,7 @@ import com.intellij.openapi.projectRoots.Sdk;
import com.intellij.openapi.projectRoots.impl.JavaAwareProjectJdkTableImpl;
import com.intellij.openapi.projectRoots.impl.ProjectJdkImpl;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.pom.java.LanguageLevel;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.TestOnly;
@@ -67,4 +54,9 @@ public class JavaTestUtil {
throw new RuntimeException(e);
}
}
public static LanguageLevel getMaxRegisteredLanguageLevel() {
LanguageLevel[] values = LanguageLevel.values();
return values[values.length - 1];
}
}