summaryrefslogtreecommitdiff
path: root/plugins/InspectionGadgets/testsrc/com/siyeh/ig/fixes
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/InspectionGadgets/testsrc/com/siyeh/ig/fixes')
-rw-r--r--plugins/InspectionGadgets/testsrc/com/siyeh/ig/fixes/initialization/DoubleBraceInitializationFixTest.java38
-rw-r--r--plugins/InspectionGadgets/testsrc/com/siyeh/ig/fixes/memory/InnerClassMayBeStaticFixTest.java (renamed from plugins/InspectionGadgets/testsrc/com/siyeh/ig/fixes/performance/InnerClassMayBeStaticFixTest.java)6
-rw-r--r--plugins/InspectionGadgets/testsrc/com/siyeh/ig/fixes/style/CStyleArrayDeclarationFixTest.java37
-rw-r--r--plugins/InspectionGadgets/testsrc/com/siyeh/ig/fixes/threading/IntroduceHolderFixTest.java41
-rw-r--r--plugins/InspectionGadgets/testsrc/com/siyeh/ig/fixes/threading/MakeFieldVolatileFixTest.java37
5 files changed, 156 insertions, 3 deletions
diff --git a/plugins/InspectionGadgets/testsrc/com/siyeh/ig/fixes/initialization/DoubleBraceInitializationFixTest.java b/plugins/InspectionGadgets/testsrc/com/siyeh/ig/fixes/initialization/DoubleBraceInitializationFixTest.java
new file mode 100644
index 000000000000..afce138a7a82
--- /dev/null
+++ b/plugins/InspectionGadgets/testsrc/com/siyeh/ig/fixes/initialization/DoubleBraceInitializationFixTest.java
@@ -0,0 +1,38 @@
+/*
+ * Copyright 2000-2014 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.
+ */
+package com.siyeh.ig.fixes.initialization;
+
+import com.siyeh.InspectionGadgetsBundle;
+import com.siyeh.ig.IGQuickFixesTestCase;
+import com.siyeh.ig.initialization.DoubleBraceInitializationInspection;
+
+/**
+ * @author Bas Leijdekkers
+ */
+public class DoubleBraceInitializationFixTest extends IGQuickFixesTestCase {
+
+ public void testLocalVariable() { doTest(); }
+ public void testField() { doTest(); }
+ public void testArgument() { assertQuickfixNotAvailable(); }
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ myFixture.enableInspections(new DoubleBraceInitializationInspection());
+ myRelativePath = "initialization/double_brace_initialization";
+ myDefaultHint = InspectionGadgetsBundle.message("double.brace.initialization.quickfix");
+ }
+}
diff --git a/plugins/InspectionGadgets/testsrc/com/siyeh/ig/fixes/performance/InnerClassMayBeStaticFixTest.java b/plugins/InspectionGadgets/testsrc/com/siyeh/ig/fixes/memory/InnerClassMayBeStaticFixTest.java
index 92a27c5ac236..42c36bf212fb 100644
--- a/plugins/InspectionGadgets/testsrc/com/siyeh/ig/fixes/performance/InnerClassMayBeStaticFixTest.java
+++ b/plugins/InspectionGadgets/testsrc/com/siyeh/ig/fixes/memory/InnerClassMayBeStaticFixTest.java
@@ -13,11 +13,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package com.siyeh.ig.fixes.performance;
+package com.siyeh.ig.fixes.memory;
import com.siyeh.InspectionGadgetsBundle;
import com.siyeh.ig.IGQuickFixesTestCase;
-import com.siyeh.ig.performance.InnerClassMayBeStaticInspection;
+import com.siyeh.ig.memory.InnerClassMayBeStaticInspection;
/**
* @author Bas Leijdekkers
@@ -28,7 +28,7 @@ public class InnerClassMayBeStaticFixTest extends IGQuickFixesTestCase {
protected void setUp() throws Exception {
super.setUp();
myFixture.enableInspections(new InnerClassMayBeStaticInspection());
- myRelativePath = "performance/inner_class_static";
+ myRelativePath = "memory/inner_class_static";
myDefaultHint = InspectionGadgetsBundle.message("make.static.quickfix");
}
diff --git a/plugins/InspectionGadgets/testsrc/com/siyeh/ig/fixes/style/CStyleArrayDeclarationFixTest.java b/plugins/InspectionGadgets/testsrc/com/siyeh/ig/fixes/style/CStyleArrayDeclarationFixTest.java
new file mode 100644
index 000000000000..85a07f8e08c3
--- /dev/null
+++ b/plugins/InspectionGadgets/testsrc/com/siyeh/ig/fixes/style/CStyleArrayDeclarationFixTest.java
@@ -0,0 +1,37 @@
+/*
+ * Copyright 2000-2014 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.
+ */
+package com.siyeh.ig.fixes.style;
+
+import com.siyeh.InspectionGadgetsBundle;
+import com.siyeh.ig.IGQuickFixesTestCase;
+import com.siyeh.ig.style.CStyleArrayDeclarationInspection;
+
+/**
+ * @author Bas Leijdekkers
+ */
+public class CStyleArrayDeclarationFixTest extends IGQuickFixesTestCase {
+
+ public void testSimpleMethod() { doTest(); }
+ public void testFieldWithWhitespace() { doTest(); }
+
+ @Override
+ public void setUp() throws Exception {
+ super.setUp();
+ myFixture.enableInspections(new CStyleArrayDeclarationInspection());
+ myRelativePath = "style/cstyle_array_declaration";
+ myDefaultHint = InspectionGadgetsBundle.message("c.style.array.declaration.replace.quickfix");
+ }
+}
diff --git a/plugins/InspectionGadgets/testsrc/com/siyeh/ig/fixes/threading/IntroduceHolderFixTest.java b/plugins/InspectionGadgets/testsrc/com/siyeh/ig/fixes/threading/IntroduceHolderFixTest.java
new file mode 100644
index 000000000000..28557e5f35a1
--- /dev/null
+++ b/plugins/InspectionGadgets/testsrc/com/siyeh/ig/fixes/threading/IntroduceHolderFixTest.java
@@ -0,0 +1,41 @@
+/*
+ * Copyright 2000-2014 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.
+ */
+package com.siyeh.ig.fixes.threading;
+
+import com.siyeh.InspectionGadgetsBundle;
+import com.siyeh.ig.IGQuickFixesTestCase;
+import com.siyeh.ig.initialization.NonThreadSafeLazyInitializationInspection;
+
+/**
+ * @author Bas Leijdekkers
+ */
+public class IntroduceHolderFixTest extends IGQuickFixesTestCase {
+
+ public void testNestedAssignment() { assertQuickfixNotAvailable(); }
+ public void testLocalVariableReferenced() { assertQuickfixNotAvailable(); }
+ public void testInstanceVariableReferenced() { assertQuickfixNotAvailable(); }
+ public void testStaticVariableReferenced() { doTest(); }
+ public void testNormal() { doTest(); }
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ myFixture.enableInspections(new NonThreadSafeLazyInitializationInspection()
+ );
+ myDefaultHint = InspectionGadgetsBundle.message("introduce.holder.class.quickfix");
+ myRelativePath = "threading/non_thread_safe_lazy_initialization";
+ }
+}
diff --git a/plugins/InspectionGadgets/testsrc/com/siyeh/ig/fixes/threading/MakeFieldVolatileFixTest.java b/plugins/InspectionGadgets/testsrc/com/siyeh/ig/fixes/threading/MakeFieldVolatileFixTest.java
new file mode 100644
index 000000000000..4c9a623be4d5
--- /dev/null
+++ b/plugins/InspectionGadgets/testsrc/com/siyeh/ig/fixes/threading/MakeFieldVolatileFixTest.java
@@ -0,0 +1,37 @@
+/*
+ * Copyright 2000-2014 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.
+ */
+package com.siyeh.ig.fixes.threading;
+
+import com.siyeh.InspectionGadgetsBundle;
+import com.siyeh.ig.IGQuickFixesTestCase;
+import com.siyeh.ig.threading.DoubleCheckedLockingInspection;
+
+/**
+ * @author Bas Leijdekkers
+ */
+public class MakeFieldVolatileFixTest extends IGQuickFixesTestCase {
+
+ public void testSimple() { doTest(InspectionGadgetsBundle.message("double.checked.locking.quickfix", "s_instance")); }
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ final DoubleCheckedLockingInspection inspection = new DoubleCheckedLockingInspection();
+ inspection.ignoreOnVolatileVariables = true;
+ myFixture.enableInspections(inspection);
+ myRelativePath = "threading/make_field_volatile";
+ }
+}