mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[Groovy] convert GrAccessRightsTest to Java (IDEA-327339)
GitOrigin-RevId: 89cd447cf6e949a44d0f045553fee8a686e7006d
This commit is contained in:
committed by
intellij-monorepo-bot
parent
72f552f87a
commit
e84cb5c9c8
+60
-59
@@ -1,95 +1,96 @@
|
||||
// Copyright 2000-2019 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.plugins.groovy.lang.highlighting
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package org.jetbrains.plugins.groovy.lang.highlighting;
|
||||
|
||||
import com.intellij.codeInspection.LocalInspectionTool
|
||||
import groovy.transform.CompileStatic
|
||||
import org.jetbrains.plugins.groovy.codeInspection.bugs.GroovyAccessibilityInspection
|
||||
import org.jetbrains.plugins.groovy.util.GroovyLatestTest
|
||||
import org.jetbrains.plugins.groovy.util.HighlightingTest
|
||||
import org.junit.Test
|
||||
import com.intellij.codeInspection.LocalInspectionTool;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.plugins.groovy.codeInspection.bugs.GroovyAccessibilityInspection;
|
||||
import org.jetbrains.plugins.groovy.util.GroovyLatestTest;
|
||||
import org.jetbrains.plugins.groovy.util.HighlightingTest;
|
||||
import org.junit.Test;
|
||||
|
||||
@CompileStatic
|
||||
class GrAccessRightsTest extends GroovyLatestTest implements HighlightingTest {
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
|
||||
GrAccessRightsTest() {
|
||||
super('highlighting')
|
||||
public class GrAccessRightsTest extends GroovyLatestTest implements HighlightingTest {
|
||||
public GrAccessRightsTest() {
|
||||
super("highlighting");
|
||||
}
|
||||
|
||||
@Override
|
||||
Collection<Class<? extends LocalInspectionTool>> getInspections() {
|
||||
Arrays.asList(GroovyAccessibilityInspection.class)
|
||||
public @NotNull Collection<Class<? extends LocalInspectionTool>> getInspections() {
|
||||
return Arrays.asList(GroovyAccessibilityInspection.class);
|
||||
}
|
||||
|
||||
@Test
|
||||
void 'private members'() {
|
||||
fileHighlightingTest('accessPrivateMembers.groovy')
|
||||
public void privateMembers() {
|
||||
fileHighlightingTest("accessPrivateMembers.groovy");
|
||||
}
|
||||
|
||||
@Test
|
||||
void 'private script members'() {
|
||||
fileHighlightingTest('accessPrivateScriptMembers.groovy')
|
||||
public void privateScriptMembers() {
|
||||
fileHighlightingTest("accessPrivateScriptMembers.groovy");
|
||||
}
|
||||
|
||||
@Test
|
||||
void 'constructor'() {
|
||||
fixture.addClass '''\
|
||||
package p1;
|
||||
public class MyClass {
|
||||
public MyClass() {}
|
||||
protected MyClass(int i) {}
|
||||
MyClass(int i, int j) {}
|
||||
private MyClass(int i, int j, int k) {}
|
||||
}
|
||||
'''
|
||||
fileHighlightingTest('accessConstructor.groovy')
|
||||
public void constructor() {
|
||||
getFixture().addClass("""
|
||||
package p1;
|
||||
public class MyClass {
|
||||
public MyClass() {}
|
||||
protected MyClass(int i) {}
|
||||
MyClass(int i, int j) {}
|
||||
private MyClass(int i, int j, int k) {}
|
||||
}
|
||||
""");
|
||||
fileHighlightingTest("accessConstructor.groovy");
|
||||
}
|
||||
|
||||
@Test
|
||||
void 'method'() {
|
||||
fixture.addClass '''\
|
||||
package p1;
|
||||
public class MyClass {
|
||||
public void publicMethod() {}
|
||||
protected void protectedMethod() {}
|
||||
void packageLocalMethod() {}
|
||||
private void privateMethod() {}
|
||||
}
|
||||
'''
|
||||
fileHighlightingTest('accessMethod.groovy')
|
||||
public void method() {
|
||||
getFixture().addClass("""
|
||||
package p1;
|
||||
public class MyClass {
|
||||
public void publicMethod() {}
|
||||
protected void protectedMethod() {}
|
||||
void packageLocalMethod() {}
|
||||
private void privateMethod() {}
|
||||
}
|
||||
""");
|
||||
fileHighlightingTest("accessMethod.groovy");
|
||||
}
|
||||
|
||||
@Test
|
||||
void 'property'() {
|
||||
fileHighlightingTest('accessProperty.groovy')
|
||||
public void property() {
|
||||
fileHighlightingTest("accessProperty.groovy");
|
||||
}
|
||||
|
||||
@Test
|
||||
void 'trait method'() {
|
||||
fileHighlightingTest('accessTraitMethod.groovy')
|
||||
public void traitMethod() {
|
||||
fileHighlightingTest("accessTraitMethod.groovy");
|
||||
}
|
||||
|
||||
@Test
|
||||
void 'nested class'() {
|
||||
fixture.addClass '''\
|
||||
package p1;
|
||||
public void nestedClass() {
|
||||
getFixture().addClass("""
|
||||
package p1;
|
||||
|
||||
public class Outer {
|
||||
public static class PublicClass {}
|
||||
protected static class ProtectedClass {}
|
||||
static class PackageLocalClass {}
|
||||
private static class PrivateClass {}
|
||||
}
|
||||
'''
|
||||
fileHighlightingTest('accessClass.groovy')
|
||||
public class Outer {
|
||||
public static class PublicClass {}
|
||||
protected static class ProtectedClass {}
|
||||
static class PackageLocalClass {}
|
||||
private static class PrivateClass {}
|
||||
}
|
||||
""");
|
||||
fileHighlightingTest("accessClass.groovy");
|
||||
}
|
||||
|
||||
@Test
|
||||
void 'method @CS'() {
|
||||
fileHighlightingTest('accessMethodCS.groovy')
|
||||
public void methodCS() {
|
||||
fileHighlightingTest("accessMethodCS.groovy");
|
||||
}
|
||||
|
||||
@Test
|
||||
void 'static imported property'() {
|
||||
fileHighlightingTest('accessStaticImportedProperty.groovy')
|
||||
public void staticImportedProperty() {
|
||||
fileHighlightingTest("accessStaticImportedProperty.groovy");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user