diff options
Diffstat (limited to 'java/java-tests/testSrc/com/intellij/codeInspection/DataFlowInspectionTest.java')
-rw-r--r-- | java/java-tests/testSrc/com/intellij/codeInspection/DataFlowInspectionTest.java | 61 |
1 files changed, 38 insertions, 23 deletions
diff --git a/java/java-tests/testSrc/com/intellij/codeInspection/DataFlowInspectionTest.java b/java/java-tests/testSrc/com/intellij/codeInspection/DataFlowInspectionTest.java index 833b5196d74a..4cba2ab918a7 100644 --- a/java/java-tests/testSrc/com/intellij/codeInspection/DataFlowInspectionTest.java +++ b/java/java-tests/testSrc/com/intellij/codeInspection/DataFlowInspectionTest.java @@ -139,6 +139,12 @@ public class DataFlowInspectionTest extends LightCodeInsightFixtureTestCase { myFixture.checkResultByFile(getTestName(false) + "_after.java"); } + public void testReportConstantReferences_OverloadedCall() { + doTestReportConstantReferences(); + myFixture.launchAction(myFixture.findSingleIntention("Replace with 'null'")); + myFixture.checkResultByFile(getTestName(false) + "_after.java"); + } + public void testReportConstantReferencesAfterFinalFieldAccess() { doTestReportConstantReferences(); } private void doTestReportConstantReferences() { @@ -148,28 +154,6 @@ public class DataFlowInspectionTest extends LightCodeInsightFixtureTestCase { myFixture.testHighlighting(true, false, true, getTestName(false) + ".java"); } - public void _testReportConstantReferences_ReplaceWithString() { - doTestReportConstantReferences(); - myFixture.launchAction(myFixture.findSingleIntention("Replace with 'CONST'")); - myFixture.checkResultByFile(getTestName(false) + "_after.java"); - } - public void _testReportConstantReferences_ReplaceWithIntConstant() { - doTestReportConstantReferences(); - myFixture.launchAction(myFixture.findSingleIntention("Replace with 'CONST'")); - myFixture.checkResultByFile(getTestName(false) + "_after.java"); - } - public void _testReportConstantReferences_ReplaceWithEnum() { - myFixture.addClass("package foo; public enum MyEnum { FOO }"); - doTestReportConstantReferences(); - myFixture.launchAction(myFixture.findSingleIntention("Replace with 'FOO'")); - myFixture.checkResultByFile(getTestName(false) + "_after.java"); - } - public void _testReportConstantReferences_NotInComplexAssignment() { - doTestReportConstantReferences(); - assertEmpty(myFixture.filterAvailableIntentions("Replace with")); - } - public void _testReportConstantReferences_Switch() { doTestReportConstantReferences(); } - public void testCheckFieldInitializers() { doTest(); } @@ -190,6 +174,7 @@ public class DataFlowInspectionTest extends LightCodeInsightFixtureTestCase { public void testTransientFinalField() { doTest(); } public void testFinalFieldDuringInitialization() { doTest(); } + public void testFinalFieldDuringSuperInitialization() { doTest(); } public void _testSymmetricUncheckedCast() { doTest(); } // http://youtrack.jetbrains.com/issue/IDEABKL-6871 public void testNullCheckDoesntAffectUncheckedCast() { doTest(); } public void testThrowNull() { doTest(); } @@ -265,6 +250,13 @@ public class DataFlowInspectionTest extends LightCodeInsightFixtureTestCase { public void testSameComparisonTwice() { doTest(); } public void testRootThrowableCause() { doTest(); } + public void testUseInferredContracts() { doTest(); } + public void testContractInferenceBewareOverriding() { doTest(); } + + public void testNumberComparisonsWhenValueIsKnown() { doTest(); } + + public void testAccessingSameArrayElements() { doTest(); } + public void testParametersAreNonnullByDefault() { myFixture.addClass("package javax.annotation; public @interface ParametersAreNonnullByDefault {}"); myFixture.addClass("package javax.annotation; public @interface ParametersAreNullableByDefault {}"); @@ -280,6 +272,29 @@ public class DataFlowInspectionTest extends LightCodeInsightFixtureTestCase { myFixture.launchAction(myFixture.findSingleIntention("Remove redundant assignment")); myFixture.checkResultByFile(getTestName(false) + "_after.java"); } - + + public void testAssertThat() { + myFixture.addClass("package org.hamcrest; public class CoreMatchers { " + + "public static <T> Matcher<T> notNullValue() {}\n" + + "public static <T> Matcher<T> not(Matcher<T> matcher) {}\n" + + "public static <T> Matcher<T> equalTo(T operand) {}\n" + + "}"); + myFixture.addClass("package org.hamcrest; public interface Matcher<T> {}"); + myFixture.addClass("package org.junit; public class Assert { " + + "public static <T> void assertThat(T actual, org.hamcrest.Matcher<? super T> matcher) {}\n" + + "public static <T> void assertThat(String msg, T actual, org.hamcrest.Matcher<? super T> matcher) {}\n" + + "}"); + myFixture.enableInspections(new DataFlowInspection()); + myFixture.testHighlighting(true, false, true, getTestName(false) + ".java"); + } + + public void testGuavaCheckNotNull() { + myFixture.addClass("package com.google.common.base; public class Preconditions { " + + "public static <T> T checkNotNull(T reference) {}\n" + + "}"); + myFixture.enableInspections(new DataFlowInspection()); + myFixture.testHighlighting(true, false, true, getTestName(false) + ".java"); + } + public void _testNullCheckBeforeInstanceof() { doTest(); } // http://youtrack.jetbrains.com/issue/IDEA-113220 } |