mirror of
https://gitflic.ru/project/openide/openide.git
synced 2025-12-17 07:20:53 +07:00
[test] Set test inspections to error level
Makes test inspections that report code that will give a guaranteed runtime error be at error level by default. GitOrigin-RevId: 5fd05b4e8e9f9f1f80fa87280eb8166e6dd497f6
This commit is contained in:
committed by
intellij-monorepo-bot
parent
b87277a346
commit
cf40811d53
@@ -18,7 +18,7 @@ class JavaJUnitMalformedDeclarationInspectionTest : JUnitMalformedDeclarationIns
|
||||
myFixture.testHighlighting(JvmLanguage.JAVA, """
|
||||
class A {
|
||||
@org.junit.jupiter.api.extension.RegisterExtension
|
||||
Rule5 <warning descr="Field 'myRule5' annotated with '@RegisterExtension' should be of type 'org.junit.jupiter.api.extension.Extension'">myRule5</warning> = new Rule5();
|
||||
Rule5 <error descr="Field 'myRule5' annotated with '@RegisterExtension' should be of type 'org.junit.jupiter.api.extension.Extension'">myRule5</error> = new Rule5();
|
||||
class Rule5 { }
|
||||
}
|
||||
""".trimIndent())
|
||||
@@ -27,7 +27,7 @@ class JavaJUnitMalformedDeclarationInspectionTest : JUnitMalformedDeclarationIns
|
||||
myFixture.testHighlighting(JvmLanguage.JAVA, """
|
||||
class A {
|
||||
@org.junit.jupiter.api.extension.RegisterExtension
|
||||
private Rule5 <warning descr="Field 'myRule5' annotated with '@RegisterExtension' should be public">myRule5</warning> = new Rule5();
|
||||
private Rule5 <error descr="Field 'myRule5' annotated with '@RegisterExtension' should be public">myRule5</error> = new Rule5();
|
||||
class Rule5 implements org.junit.jupiter.api.extension.Extension { }
|
||||
}
|
||||
""".trimIndent())
|
||||
@@ -46,13 +46,13 @@ class JavaJUnitMalformedDeclarationInspectionTest : JUnitMalformedDeclarationIns
|
||||
myFixture.testHighlighting(JvmLanguage.JAVA, """
|
||||
class A {
|
||||
@org.junit.jupiter.api.Nested
|
||||
static class <warning descr="Tests in nested class will not be executed">B</warning> { }
|
||||
static class <error descr="Tests in nested class will not be executed">B</error> { }
|
||||
|
||||
@org.junit.jupiter.api.Nested
|
||||
private class <warning descr="Tests in nested class will not be executed">C</warning> { }
|
||||
private class <error descr="Tests in nested class will not be executed">C</error> { }
|
||||
|
||||
@org.junit.jupiter.api.Nested
|
||||
private static class <warning descr="Tests in nested class will not be executed">D</warning> { }
|
||||
private static class <error descr="Tests in nested class will not be executed">D</error> { }
|
||||
}
|
||||
""".trimIndent())
|
||||
}
|
||||
@@ -97,7 +97,7 @@ class JavaJUnitMalformedDeclarationInspectionTest : JUnitMalformedDeclarationIns
|
||||
fun `test highlighting non executable JUnit 4 nested class`() {
|
||||
myFixture.testHighlighting(JvmLanguage.JAVA, """
|
||||
class A {
|
||||
public class <warning descr="Tests in nested class will not be executed">B</warning> {
|
||||
public class <error descr="Tests in nested class will not be executed">B</error> {
|
||||
@org.junit.Test
|
||||
public void testFoo() { }
|
||||
}
|
||||
@@ -128,7 +128,7 @@ class JavaJUnitMalformedDeclarationInspectionTest : JUnitMalformedDeclarationIns
|
||||
fun `test highlighting no nested annotation in JUnit 5`() {
|
||||
myFixture.testHighlighting(JvmLanguage.JAVA, """
|
||||
class A {
|
||||
class <warning descr="Tests in nested class will not be executed">B</warning> {
|
||||
class <error descr="Tests in nested class will not be executed">B</error> {
|
||||
@org.junit.jupiter.api.Test
|
||||
public void testFoo() { }
|
||||
}
|
||||
@@ -390,7 +390,7 @@ class JavaJUnitMalformedDeclarationInspectionTest : JUnitMalformedDeclarationIns
|
||||
myFixture.testHighlighting(JvmLanguage.JAVA, """
|
||||
class MyTest {
|
||||
@org.junit.jupiter.params.ParameterizedTest
|
||||
<warning descr="'@EmptySource' cannot provide an argument to method because method has an unsupported parameter of 'MyArgMap' type">@org.junit.jupiter.params.provider.EmptySource</warning>
|
||||
<error descr="'@EmptySource' cannot provide an argument to method because method has an unsupported parameter of 'MyArgMap' type">@org.junit.jupiter.params.provider.EmptySource</error>
|
||||
void testArgMap(MyArgMap input) { }
|
||||
}
|
||||
""".trimIndent())
|
||||
@@ -406,7 +406,7 @@ class JavaJUnitMalformedDeclarationInspectionTest : JUnitMalformedDeclarationIns
|
||||
myFixture.testHighlighting(JvmLanguage.JAVA, """
|
||||
class MyTest {
|
||||
@org.junit.jupiter.params.ParameterizedTest
|
||||
<warning descr="'@EmptySource' cannot provide an argument to method because method has an unsupported parameter of 'MyArgSet' type">@org.junit.jupiter.params.provider.EmptySource</warning>
|
||||
<error descr="'@EmptySource' cannot provide an argument to method because method has an unsupported parameter of 'MyArgSet' type">@org.junit.jupiter.params.provider.EmptySource</error>
|
||||
void testArgSet(MyArgSet input) { }
|
||||
}
|
||||
""".trimIndent())
|
||||
@@ -422,7 +422,7 @@ class JavaJUnitMalformedDeclarationInspectionTest : JUnitMalformedDeclarationIns
|
||||
myFixture.testHighlighting(JvmLanguage.JAVA, """
|
||||
class MyTest {
|
||||
@org.junit.jupiter.params.ParameterizedTest
|
||||
<warning descr="'@EmptySource' cannot provide an argument to method because method has an unsupported parameter of 'MyArgSet' type">@org.junit.jupiter.params.provider.EmptySource</warning>
|
||||
<error descr="'@EmptySource' cannot provide an argument to method because method has an unsupported parameter of 'MyArgSet' type">@org.junit.jupiter.params.provider.EmptySource</error>
|
||||
void testArgSet(MyArgSet input) { }
|
||||
}
|
||||
""".trimIndent())
|
||||
@@ -432,7 +432,7 @@ class JavaJUnitMalformedDeclarationInspectionTest : JUnitMalformedDeclarationIns
|
||||
class ValueSourcesTest {
|
||||
@org.junit.jupiter.params.ParameterizedTest
|
||||
@org.junit.jupiter.params.provider.ValueSource(booleans = {
|
||||
<warning descr="No implicit conversion found to convert 'boolean' to 'int'">false</warning>
|
||||
<error descr="No implicit conversion found to convert 'boolean' to 'int'">false</error>
|
||||
})
|
||||
void testWithBooleanSource(int argument) { }
|
||||
}
|
||||
@@ -443,7 +443,7 @@ class JavaJUnitMalformedDeclarationInspectionTest : JUnitMalformedDeclarationIns
|
||||
enum TestEnum { FIRST, SECOND, THIRD }
|
||||
class ValueSourcesTest {
|
||||
@org.junit.jupiter.params.ParameterizedTest
|
||||
@org.junit.jupiter.params.provider.EnumSource(<warning descr="No implicit conversion found to convert 'TestEnum' to 'int'">TestEnum.class</warning>)
|
||||
@org.junit.jupiter.params.provider.EnumSource(<error descr="No implicit conversion found to convert 'TestEnum' to 'int'">TestEnum.class</error>)
|
||||
void testWithEnumSource(int i) { }
|
||||
}
|
||||
""".trimIndent())
|
||||
@@ -452,7 +452,7 @@ class JavaJUnitMalformedDeclarationInspectionTest : JUnitMalformedDeclarationIns
|
||||
myFixture.testHighlighting(JvmLanguage.JAVA, """
|
||||
class ValueSourcesTest {
|
||||
@org.junit.jupiter.params.ParameterizedTest
|
||||
@org.junit.jupiter.params.provider.<warning descr="Exactly one type of input must be provided">ValueSource</warning>(
|
||||
@org.junit.jupiter.params.provider.<error descr="Exactly one type of input must be provided">ValueSource</error>(
|
||||
ints = {1}, strings = "str"
|
||||
)
|
||||
void testWithMultipleValues(int i) { }
|
||||
@@ -463,7 +463,7 @@ class JavaJUnitMalformedDeclarationInspectionTest : JUnitMalformedDeclarationIns
|
||||
myFixture.testHighlighting(JvmLanguage.JAVA, """
|
||||
class ValueSourcesTest {
|
||||
@org.junit.jupiter.params.ParameterizedTest
|
||||
@org.junit.jupiter.params.provider.<warning descr="No value source is defined">ValueSource</warning>()
|
||||
@org.junit.jupiter.params.provider.<error descr="No value source is defined">ValueSource</error>()
|
||||
void testWithNoValues(int i) { }
|
||||
}
|
||||
""".trimIndent())
|
||||
@@ -472,7 +472,7 @@ class JavaJUnitMalformedDeclarationInspectionTest : JUnitMalformedDeclarationIns
|
||||
myFixture.testHighlighting(JvmLanguage.JAVA, """
|
||||
class ValueSourcesTest {
|
||||
@org.junit.jupiter.params.ParameterizedTest
|
||||
<warning descr="'@NullSource' cannot provide an argument to method because method doesn't have parameters">@org.junit.jupiter.params.provider.NullSource</warning>
|
||||
<error descr="'@NullSource' cannot provide an argument to method because method doesn't have parameters">@org.junit.jupiter.params.provider.NullSource</error>
|
||||
void testWithNullSrcNoParam() {}
|
||||
}
|
||||
""".trimIndent())
|
||||
@@ -482,7 +482,7 @@ class JavaJUnitMalformedDeclarationInspectionTest : JUnitMalformedDeclarationIns
|
||||
class ValueSourcesTest {
|
||||
@org.junit.jupiter.params.ParameterizedTest
|
||||
@org.junit.jupiter.params.provider.ValueSource(strings = "foo")
|
||||
void <warning descr="Multiple parameters are not supported by this source">testWithMultipleParams</warning>(String argument, int i) { }
|
||||
void <error descr="Multiple parameters are not supported by this source">testWithMultipleParams</error>(String argument, int i) { }
|
||||
}
|
||||
""".trimIndent())
|
||||
}
|
||||
@@ -492,7 +492,7 @@ class JavaJUnitMalformedDeclarationInspectionTest : JUnitMalformedDeclarationIns
|
||||
@org.junit.jupiter.params.ParameterizedTest
|
||||
@org.junit.jupiter.params.provider.ValueSource(ints = {1})
|
||||
@org.junit.jupiter.api.Test
|
||||
void <warning descr="Suspicious combination of '@Test' and '@ParameterizedTest'">testWithTestAnnotation</warning>(int i) { }
|
||||
void <error descr="Suspicious combination of '@Test' and '@ParameterizedTest'">testWithTestAnnotation</error>(int i) { }
|
||||
}
|
||||
""".trimIndent())
|
||||
}
|
||||
@@ -501,7 +501,7 @@ class JavaJUnitMalformedDeclarationInspectionTest : JUnitMalformedDeclarationIns
|
||||
class ValueSourcesTest {
|
||||
@org.junit.jupiter.params.provider.ValueSource(ints = {1})
|
||||
@org.junit.jupiter.api.Test
|
||||
void <warning descr="Suspicious combination of '@ValueSource' and '@Test'">testWithTestAnnotationNoParameterized</warning>(int i) { }
|
||||
void <error descr="Suspicious combination of '@ValueSource' and '@Test'">testWithTestAnnotationNoParameterized</error>(int i) { }
|
||||
}
|
||||
""".trimIndent())
|
||||
}
|
||||
@@ -510,7 +510,7 @@ class JavaJUnitMalformedDeclarationInspectionTest : JUnitMalformedDeclarationIns
|
||||
class ValueSourcesTest {
|
||||
@org.junit.jupiter.params.ParameterizedTest
|
||||
@org.junit.jupiter.params.provider.ArgumentsSources({})
|
||||
void <warning descr="No sources are provided, the suite would be empty">emptyArgs</warning>(String param) { }
|
||||
void <error descr="No sources are provided, the suite would be empty">emptyArgs</error>(String param) { }
|
||||
}
|
||||
""".trimIndent())
|
||||
}
|
||||
@@ -518,7 +518,7 @@ class JavaJUnitMalformedDeclarationInspectionTest : JUnitMalformedDeclarationIns
|
||||
myFixture.testHighlighting(JvmLanguage.JAVA, """
|
||||
class ValueSourcesTest {
|
||||
@org.junit.jupiter.params.ParameterizedTest
|
||||
@org.junit.jupiter.params.provider.MethodSource({ <warning descr="Method source 'a' must be static">"a"</warning> })
|
||||
@org.junit.jupiter.params.provider.MethodSource({ <error descr="Method source 'a' must be static">"a"</error> })
|
||||
void foo(String param) { }
|
||||
|
||||
String[] a() { return new String[] {"a", "b"}; }
|
||||
@@ -529,7 +529,7 @@ class JavaJUnitMalformedDeclarationInspectionTest : JUnitMalformedDeclarationIns
|
||||
myFixture.testHighlighting(JvmLanguage.JAVA, """
|
||||
class ValueSourcesTest {
|
||||
@org.junit.jupiter.params.ParameterizedTest
|
||||
@org.junit.jupiter.params.provider.MethodSource({ <warning descr="Method source 'a' should have no parameters">"a"</warning> })
|
||||
@org.junit.jupiter.params.provider.MethodSource({ <error descr="Method source 'a' should have no parameters">"a"</error> })
|
||||
void foo(String param) { }
|
||||
|
||||
static String[] a(int i) { return new String[] {"a", "b"}; }
|
||||
@@ -540,7 +540,7 @@ class JavaJUnitMalformedDeclarationInspectionTest : JUnitMalformedDeclarationIns
|
||||
myFixture.testHighlighting(JvmLanguage.JAVA, """
|
||||
class ValueSourcesTest {
|
||||
@org.junit.jupiter.params.ParameterizedTest
|
||||
@org.junit.jupiter.params.provider.MethodSource({ <warning descr="Method source 'a' must have one of the following return types: 'Stream<?>', 'Iterator<?>', 'Iterable<?>' or 'Object[]'">"a"</warning> })
|
||||
@org.junit.jupiter.params.provider.MethodSource({ <error descr="Method source 'a' must have one of the following return types: 'Stream<?>', 'Iterator<?>', 'Iterable<?>' or 'Object[]'">"a"</error> })
|
||||
void foo(String param) { }
|
||||
|
||||
static Object a() { return new String[] {"a", "b"}; }
|
||||
@@ -551,7 +551,7 @@ class JavaJUnitMalformedDeclarationInspectionTest : JUnitMalformedDeclarationIns
|
||||
myFixture.testHighlighting(JvmLanguage.JAVA, """
|
||||
class ValueSourcesTest {
|
||||
@org.junit.jupiter.params.ParameterizedTest
|
||||
@org.junit.jupiter.params.provider.MethodSource({ <warning descr="Cannot resolve target method source: 'a'">"a"</warning> })
|
||||
@org.junit.jupiter.params.provider.MethodSource({ <error descr="Cannot resolve target method source: 'a'">"a"</error> })
|
||||
void foo(String param) { }
|
||||
}
|
||||
""".trimIndent())
|
||||
@@ -564,7 +564,7 @@ class JavaJUnitMalformedDeclarationInspectionTest : JUnitMalformedDeclarationIns
|
||||
@org.junit.jupiter.params.ParameterizedTest
|
||||
@org.junit.jupiter.params.provider.EnumSource(
|
||||
value = Foo.class,
|
||||
names = <warning descr="Can't resolve 'enum' constant reference.">"invalid-value"</warning>,
|
||||
names = <error descr="Can't resolve 'enum' constant reference.">"invalid-value"</error>,
|
||||
mode = org.junit.jupiter.params.provider.EnumSource.Mode.INCLUDE
|
||||
)
|
||||
void invalid() { }
|
||||
@@ -572,7 +572,7 @@ class JavaJUnitMalformedDeclarationInspectionTest : JUnitMalformedDeclarationIns
|
||||
@org.junit.jupiter.params.ParameterizedTest
|
||||
@org.junit.jupiter.params.provider.EnumSource(
|
||||
value = Foo.class,
|
||||
names = <warning descr="Can't resolve 'enum' constant reference.">"invalid-value"</warning>
|
||||
names = <error descr="Can't resolve 'enum' constant reference.">"invalid-value"</error>
|
||||
)
|
||||
void invalidDefault() { }
|
||||
}
|
||||
@@ -701,7 +701,7 @@ class JavaJUnitMalformedDeclarationInspectionTest : JUnitMalformedDeclarationIns
|
||||
class WithRepeatedAndTests {
|
||||
@org.junit.jupiter.api.Test
|
||||
@org.junit.jupiter.api.RepeatedTest(1)
|
||||
void <warning descr="Suspicious combination of '@Test' and '@RepeatedTest'">repeatedTestAndTest</warning>() { }
|
||||
void <error descr="Suspicious combination of '@Test' and '@RepeatedTest'">repeatedTestAndTest</error>() { }
|
||||
}
|
||||
""".trimIndent())
|
||||
}
|
||||
@@ -712,7 +712,7 @@ class JavaJUnitMalformedDeclarationInspectionTest : JUnitMalformedDeclarationIns
|
||||
void beforeEach(org.junit.jupiter.api.RepetitionInfo repetitionInfo) { }
|
||||
|
||||
@org.junit.jupiter.api.Test
|
||||
void <warning descr="Method 'nonRepeated' annotated with '@Test' should not declare parameter 'repetitionInfo'">nonRepeated</warning>(org.junit.jupiter.api.RepetitionInfo repetitionInfo) { }
|
||||
void <error descr="Method 'nonRepeated' annotated with '@Test' should not declare parameter 'repetitionInfo'">nonRepeated</error>(org.junit.jupiter.api.RepetitionInfo repetitionInfo) { }
|
||||
}
|
||||
""".trimIndent())
|
||||
}
|
||||
@@ -720,17 +720,17 @@ class JavaJUnitMalformedDeclarationInspectionTest : JUnitMalformedDeclarationIns
|
||||
myFixture.testHighlighting(JvmLanguage.JAVA, """
|
||||
class WithBeforeEach {
|
||||
@org.junit.jupiter.api.BeforeAll
|
||||
void <warning descr="Method 'beforeAllWithRepetitionInfo' annotated with '@BeforeAll' should be static and not declare parameter 'repetitionInfo'">beforeAllWithRepetitionInfo</warning>(org.junit.jupiter.api.RepetitionInfo repetitionInfo) { }
|
||||
void <error descr="Method 'beforeAllWithRepetitionInfo' annotated with '@BeforeAll' should be static and not declare parameter 'repetitionInfo'">beforeAllWithRepetitionInfo</error>(org.junit.jupiter.api.RepetitionInfo repetitionInfo) { }
|
||||
}
|
||||
""".trimIndent())
|
||||
}
|
||||
fun `test malformed repeated test with non-positive repetitions highlighting`() {
|
||||
myFixture.testHighlighting(JvmLanguage.JAVA, """
|
||||
class WithRepeated {
|
||||
@org.junit.jupiter.api.RepeatedTest(<warning descr="The number of repetitions must be greater than zero">-1</warning>)
|
||||
@org.junit.jupiter.api.RepeatedTest(<error descr="The number of repetitions must be greater than zero">-1</error>)
|
||||
void repeatedTestNegative() { }
|
||||
|
||||
@org.junit.jupiter.api.RepeatedTest(<warning descr="The number of repetitions must be greater than zero">0</warning>)
|
||||
@org.junit.jupiter.api.RepeatedTest(<error descr="The number of repetitions must be greater than zero">0</error>)
|
||||
void repeatedTestBoundaryZero() { }
|
||||
}
|
||||
""".trimIndent())
|
||||
@@ -741,7 +741,7 @@ class JavaJUnitMalformedDeclarationInspectionTest : JUnitMalformedDeclarationIns
|
||||
myFixture.testHighlighting(JvmLanguage.JAVA, """
|
||||
class MainTest {
|
||||
@org.junit.Before
|
||||
String <warning descr="Method 'before' annotated with '@Before' should be public, of type 'void' and not declare parameter 'i'">before</warning>(int i) { return ""; }
|
||||
String <error descr="Method 'before' annotated with '@Before' should be public, of type 'void' and not declare parameter 'i'">before</error>(int i) { return ""; }
|
||||
}
|
||||
""".trimIndent())
|
||||
}
|
||||
@@ -749,7 +749,7 @@ class JavaJUnitMalformedDeclarationInspectionTest : JUnitMalformedDeclarationIns
|
||||
myFixture.testHighlighting(JvmLanguage.JAVA, """
|
||||
class MainTest {
|
||||
@org.junit.jupiter.api.BeforeEach
|
||||
String <warning descr="Method 'beforeEach' annotated with '@BeforeEach' should be of type 'void' and not declare parameter 'i'">beforeEach</warning>(int i) { return ""; }
|
||||
String <error descr="Method 'beforeEach' annotated with '@BeforeEach' should be of type 'void' and not declare parameter 'i'">beforeEach</error>(int i) { return ""; }
|
||||
}
|
||||
""".trimIndent())
|
||||
}
|
||||
@@ -818,7 +818,7 @@ class JavaJUnitMalformedDeclarationInspectionTest : JUnitMalformedDeclarationIns
|
||||
myFixture.testHighlighting(JvmLanguage.JAVA, """
|
||||
class MainTest {
|
||||
@org.junit.jupiter.api.BeforeAll
|
||||
String <warning descr="Method 'beforeAll' annotated with '@BeforeAll' should be static, of type 'void' and not declare parameter 'i'">beforeAll</warning>(int i) { return ""; }
|
||||
String <error descr="Method 'beforeAll' annotated with '@BeforeAll' should be static, of type 'void' and not declare parameter 'i'">beforeAll</error>(int i) { return ""; }
|
||||
}
|
||||
""".trimIndent())
|
||||
}
|
||||
@@ -877,35 +877,35 @@ class JavaJUnitMalformedDeclarationInspectionTest : JUnitMalformedDeclarationIns
|
||||
fun `test malformed dataPoint non-static highlighting`() {
|
||||
myFixture.testHighlighting(JvmLanguage.JAVA, """
|
||||
class Test {
|
||||
@org.junit.experimental.theories.DataPoint public Object <warning descr="Field 'f1' annotated with '@DataPoint' should be static">f1</warning>;
|
||||
@org.junit.experimental.theories.DataPoint public Object <error descr="Field 'f1' annotated with '@DataPoint' should be static">f1</error>;
|
||||
}
|
||||
""".trimIndent())
|
||||
}
|
||||
fun `test malformed dataPoint non-public highlighting`() {
|
||||
myFixture.testHighlighting(JvmLanguage.JAVA, """
|
||||
class Test {
|
||||
@org.junit.experimental.theories.DataPoint static Object <warning descr="Field 'f1' annotated with '@DataPoint' should be public">f1</warning>;
|
||||
@org.junit.experimental.theories.DataPoint static Object <error descr="Field 'f1' annotated with '@DataPoint' should be public">f1</error>;
|
||||
}
|
||||
""".trimIndent())
|
||||
}
|
||||
fun `test malformed dataPoint field highlighting`() {
|
||||
myFixture.testHighlighting(JvmLanguage.JAVA, """
|
||||
class Test {
|
||||
@org.junit.experimental.theories.DataPoint Object <warning descr="Field 'f1' annotated with '@DataPoint' should be static and public">f1</warning>;
|
||||
@org.junit.experimental.theories.DataPoint Object <error descr="Field 'f1' annotated with '@DataPoint' should be static and public">f1</error>;
|
||||
}
|
||||
""".trimIndent())
|
||||
}
|
||||
fun `test malformed datapoint method highlighting`() {
|
||||
myFixture.testHighlighting(JvmLanguage.JAVA, """
|
||||
class Test {
|
||||
@org.junit.experimental.theories.DataPoint Object <warning descr="Method 'f1' annotated with '@DataPoint' should be static and public">f1</warning>() { return null; }
|
||||
@org.junit.experimental.theories.DataPoint Object <error descr="Method 'f1' annotated with '@DataPoint' should be static and public">f1</error>() { return null; }
|
||||
}
|
||||
""".trimIndent())
|
||||
}
|
||||
fun `test malformed datapoints method highlighting`() {
|
||||
myFixture.testHighlighting(JvmLanguage.JAVA, """
|
||||
class Test {
|
||||
@org.junit.experimental.theories.DataPoints Object <warning descr="Method 'f1' annotated with '@DataPoints' should be static and public">f1</warning>() { return null; }
|
||||
@org.junit.experimental.theories.DataPoints Object <error descr="Method 'f1' annotated with '@DataPoints' should be static and public">f1</error>() { return null; }
|
||||
}
|
||||
""".trimIndent())
|
||||
}
|
||||
@@ -934,7 +934,7 @@ class JavaJUnitMalformedDeclarationInspectionTest : JUnitMalformedDeclarationIns
|
||||
fun `test malformed setup highlighting`() {
|
||||
myFixture.testHighlighting(JvmLanguage.JAVA, """
|
||||
public class C extends junit.framework.TestCase {
|
||||
private void <warning descr="Method 'setUp' should be non-private, non-static, have no parameters and of type void">setUp</warning>(int i) { }
|
||||
private void <error descr="Method 'setUp' should be non-private, non-static, have no parameters and of type void">setUp</error>(int i) { }
|
||||
}
|
||||
""".trimIndent(), "C")
|
||||
}
|
||||
@@ -964,10 +964,10 @@ class JavaJUnitMalformedDeclarationInspectionTest : JUnitMalformedDeclarationIns
|
||||
|
||||
class RuleTest {
|
||||
@org.junit.Rule
|
||||
private SomeTestRule <warning descr="Field 'x' annotated with '@Rule' should be public">x</warning>;
|
||||
private SomeTestRule <error descr="Field 'x' annotated with '@Rule' should be public">x</error>;
|
||||
|
||||
@org.junit.Rule
|
||||
public static SomeTestRule <warning descr="Field 'y' annotated with '@Rule' should be non-static">y</warning>;
|
||||
public static SomeTestRule <error descr="Field 'y' annotated with '@Rule' should be non-static">y</error>;
|
||||
}
|
||||
""".trimIndent())
|
||||
}
|
||||
@@ -975,7 +975,7 @@ class JavaJUnitMalformedDeclarationInspectionTest : JUnitMalformedDeclarationIns
|
||||
myFixture.testHighlighting(JvmLanguage.JAVA, """
|
||||
class RuleTest {
|
||||
@org.junit.Rule
|
||||
public int <warning descr="Field 'x' annotated with '@Rule' should be of type 'org.junit.rules.TestRule'">x</warning>;
|
||||
public int <error descr="Field 'x' annotated with '@Rule' should be of type 'org.junit.rules.TestRule'">x</error>;
|
||||
}
|
||||
""".trimIndent())
|
||||
}
|
||||
@@ -992,7 +992,7 @@ class JavaJUnitMalformedDeclarationInspectionTest : JUnitMalformedDeclarationIns
|
||||
|
||||
class RuleTest {
|
||||
@org.junit.Rule
|
||||
public static SomeTestRule <warning descr="Method 'y' annotated with '@Rule' should be non-static">y</warning>() {
|
||||
public static SomeTestRule <error descr="Method 'y' annotated with '@Rule' should be non-static">y</error>() {
|
||||
return new SomeTestRule();
|
||||
};
|
||||
}
|
||||
@@ -1011,16 +1011,16 @@ class JavaJUnitMalformedDeclarationInspectionTest : JUnitMalformedDeclarationIns
|
||||
|
||||
class ClassRuleTest {
|
||||
@org.junit.ClassRule
|
||||
static SomeTestRule <warning descr="Field 'x' annotated with '@ClassRule' should be public">x</warning> = new SomeTestRule();
|
||||
static SomeTestRule <error descr="Field 'x' annotated with '@ClassRule' should be public">x</error> = new SomeTestRule();
|
||||
|
||||
@org.junit.ClassRule
|
||||
public SomeTestRule <warning descr="Field 'y' annotated with '@ClassRule' should be static">y</warning> = new SomeTestRule();
|
||||
public SomeTestRule <error descr="Field 'y' annotated with '@ClassRule' should be static">y</error> = new SomeTestRule();
|
||||
|
||||
@org.junit.ClassRule
|
||||
private SomeTestRule <warning descr="Field 'z' annotated with '@ClassRule' should be static and public">z</warning> = new SomeTestRule();
|
||||
private SomeTestRule <error descr="Field 'z' annotated with '@ClassRule' should be static and public">z</error> = new SomeTestRule();
|
||||
|
||||
@org.junit.ClassRule
|
||||
public static int <warning descr="Field 't' annotated with '@ClassRule' should be of type 'org.junit.rules.TestRule'">t</warning> = 0;
|
||||
public static int <error descr="Field 't' annotated with '@ClassRule' should be of type 'org.junit.rules.TestRule'">t</error> = 0;
|
||||
}
|
||||
""".trimIndent())
|
||||
}
|
||||
@@ -1148,10 +1148,10 @@ class JavaJUnitMalformedDeclarationInspectionTest : JUnitMalformedDeclarationIns
|
||||
fun `test malformed test for JUnit 3 highlighting`() {
|
||||
myFixture.testHighlighting(JvmLanguage.JAVA, """
|
||||
public class JUnit3TestMethodIsPublicVoidNoArg extends junit.framework.TestCase {
|
||||
void <warning descr="Method 'testOne' should be public, non-static, have no parameters and of type void">testOne</warning>() { }
|
||||
public int <warning descr="Method 'testTwo' should be public, non-static, have no parameters and of type void">testTwo</warning>() { return 2; }
|
||||
public static void <warning descr="Method 'testThree' should be public, non-static, have no parameters and of type void">testThree</warning>() { }
|
||||
public void <warning descr="Method 'testFour' should be public, non-static, have no parameters and of type void">testFour</warning>(int i) { }
|
||||
void <error descr="Method 'testOne' should be public, non-static, have no parameters and of type void">testOne</error>() { }
|
||||
public int <error descr="Method 'testTwo' should be public, non-static, have no parameters and of type void">testTwo</error>() { return 2; }
|
||||
public static void <error descr="Method 'testThree' should be public, non-static, have no parameters and of type void">testThree</error>() { }
|
||||
public void <error descr="Method 'testFour' should be public, non-static, have no parameters and of type void">testFour</error>(int i) { }
|
||||
public void testFive() { }
|
||||
void testSix(int i) { } //ignore when method doesn't look like test anymore
|
||||
}
|
||||
@@ -1164,10 +1164,10 @@ class JavaJUnitMalformedDeclarationInspectionTest : JUnitMalformedDeclarationIns
|
||||
""".trimIndent())
|
||||
myFixture.testHighlighting(JvmLanguage.JAVA, """
|
||||
public class JUnit4TestMethodIsPublicVoidNoArg {
|
||||
@org.junit.Test void <warning descr="Method 'testOne' annotated with '@Test' should be public">testOne</warning>() {}
|
||||
@org.junit.Test public int <warning descr="Method 'testTwo' annotated with '@Test' should be of type 'void'">testTwo</warning>() { return 2; }
|
||||
@org.junit.Test public static void <warning descr="Method 'testThree' annotated with '@Test' should be non-static">testThree</warning>() {}
|
||||
@org.junit.Test public void <warning descr="Method 'testFour' annotated with '@Test' should not declare parameter 'i'">testFour</warning>(int i) {}
|
||||
@org.junit.Test void <error descr="Method 'testOne' annotated with '@Test' should be public">testOne</error>() {}
|
||||
@org.junit.Test public int <error descr="Method 'testTwo' annotated with '@Test' should be of type 'void'">testTwo</error>() { return 2; }
|
||||
@org.junit.Test public static void <error descr="Method 'testThree' annotated with '@Test' should be non-static">testThree</error>() {}
|
||||
@org.junit.Test public void <error descr="Method 'testFour' annotated with '@Test' should not declare parameter 'i'">testFour</error>(int i) {}
|
||||
@org.junit.Test public void testFive() {}
|
||||
@org.junit.Test public void testMock(@mockit.Mocked String s) {}
|
||||
}
|
||||
@@ -1195,7 +1195,7 @@ class JavaJUnitMalformedDeclarationInspectionTest : JUnitMalformedDeclarationIns
|
||||
@org.junit.runner.RunWith(org.junit.runners.JUnit4.class)
|
||||
class Foo {
|
||||
@org.junit.Test
|
||||
public int <warning descr="Method 'testMe' annotated with '@Test' should be of type 'void' and not declare parameter 'i'">testMe</warning>(int i) { return -1; }
|
||||
public int <error descr="Method 'testMe' annotated with '@Test' should be of type 'void' and not declare parameter 'i'">testMe</error>(int i) { return -1; }
|
||||
}
|
||||
""".trimIndent())
|
||||
}
|
||||
@@ -1281,7 +1281,7 @@ class JavaJUnitMalformedDeclarationInspectionTest : JUnitMalformedDeclarationIns
|
||||
myFixture.testHighlighting(JvmLanguage.JAVA, """
|
||||
import junit.framework.TestCase;
|
||||
|
||||
public class <warning descr="Test class 'UnconstructableJUnit3TestCase1' is not constructable because it does not have a 'public' no-arg or single 'String' parameter constructor">UnconstructableJUnit3TestCase1</warning> extends TestCase {
|
||||
public class <error descr="Test class 'UnconstructableJUnit3TestCase1' is not constructable because it does not have a 'public' no-arg or single 'String' parameter constructor">UnconstructableJUnit3TestCase1</error> extends TestCase {
|
||||
private UnconstructableJUnit3TestCase1() {
|
||||
System.out.println("");
|
||||
}
|
||||
@@ -1293,7 +1293,7 @@ class JavaJUnitMalformedDeclarationInspectionTest : JUnitMalformedDeclarationIns
|
||||
myFixture.testHighlighting(JvmLanguage.JAVA, """
|
||||
import junit.framework.TestCase;
|
||||
|
||||
public class <warning descr="Test class 'UnconstructableJUnit3TestCase2' is not constructable because it does not have a 'public' no-arg or single 'String' parameter constructor">UnconstructableJUnit3TestCase2</warning> extends TestCase {
|
||||
public class <error descr="Test class 'UnconstructableJUnit3TestCase2' is not constructable because it does not have a 'public' no-arg or single 'String' parameter constructor">UnconstructableJUnit3TestCase2</error> extends TestCase {
|
||||
public UnconstructableJUnit3TestCase2(Object foo) {
|
||||
System.out.println("");
|
||||
}
|
||||
@@ -1339,7 +1339,7 @@ class JavaJUnitMalformedDeclarationInspectionTest : JUnitMalformedDeclarationIns
|
||||
myFixture.testHighlighting(JvmLanguage.JAVA, """
|
||||
import org.junit.Test;
|
||||
|
||||
public class <warning descr="Test class 'UnconstructableJUnit4TestCase1' is not constructable because it should have exactly one 'public' no-arg constructor">UnconstructableJUnit4TestCase1</warning> {
|
||||
public class <error descr="Test class 'UnconstructableJUnit4TestCase1' is not constructable because it should have exactly one 'public' no-arg constructor">UnconstructableJUnit4TestCase1</error> {
|
||||
public UnconstructableJUnit4TestCase1(String s) {}
|
||||
|
||||
public UnconstructableJUnit4TestCase1() {}
|
||||
@@ -1372,7 +1372,7 @@ class JavaJUnitMalformedDeclarationInspectionTest : JUnitMalformedDeclarationIns
|
||||
myFixture.testHighlighting(JvmLanguage.JAVA, """
|
||||
import org.junit.Test;
|
||||
|
||||
class <warning descr="Test class 'UnconstructableJUnit4TestCase3' is not constructable because it is not 'public'"><warning descr="Test class 'UnconstructableJUnit4TestCase3' is not constructable because it should have exactly one 'public' no-arg constructor">UnconstructableJUnit4TestCase3</warning></warning> {
|
||||
class <error descr="Test class 'UnconstructableJUnit4TestCase3' is not constructable because it is not 'public'"><error descr="Test class 'UnconstructableJUnit4TestCase3' is not constructable because it should have exactly one 'public' no-arg constructor">UnconstructableJUnit4TestCase3</error></error> {
|
||||
UnconstructableJUnit4TestCase3() {}
|
||||
|
||||
@Test
|
||||
|
||||
Reference in New Issue
Block a user