make IG test light and test new option

This commit is contained in:
Bas Leijdekkers
2015-01-14 12:36:36 +01:00
parent f8a49b10a3
commit 852b48aaaf
3 changed files with 23 additions and 14 deletions
@@ -8,7 +8,7 @@ public class CloneDeclaresCloneNonSupportedException implements Cloneable
}
public Object clone()
protected Object <warning descr="'clone()' does not declare 'CloneNotSupportedException'">clone</warning>()
{
try
{
@@ -34,3 +34,13 @@ class Child extends CloneDeclaresCloneNonSupportedException {
return super.clone();
}
}
class NoWarnOnPublic implements Cloneable {
public Object clone() {
try {
return super.clone();
} catch (CloneNotSupportedException e) {
throw new AssertionError(e);
}
}
}
@@ -1,9 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<problems>
<problem>
<file>CloneDeclaresCloneNonSupportedException.java</file>
<line>11</line>
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">'clone()' does not declare 'CloneNotSupportedException'</problem_class>
<description>&lt;code&gt;clone()&lt;/code&gt; does not declare 'CloneNotSupportedException'</description>
</problem>
</problems>
@@ -1,10 +1,18 @@
package com.siyeh.ig.cloneable;
import com.siyeh.ig.IGInspectionTestCase;
import com.intellij.codeInspection.InspectionProfileEntry;
import com.siyeh.ig.LightInspectionTestCase;
import org.jetbrains.annotations.Nullable;
public class CloneDeclaresCloneNotSupportedInspectionTest extends IGInspectionTestCase {
public class CloneDeclaresCloneNotSupportedInspectionTest extends LightInspectionTestCase {
public void test() throws Exception {
doTest("com/siyeh/igtest/cloneable/clone_declares_clone_not_supported", new CloneDeclaresCloneNotSupportedInspection());
public void testCloneDeclaresCloneNonSupportedException() {
doTest();
}
@Nullable
@Override
protected InspectionProfileEntry getInspection() {
return new CloneDeclaresCloneNotSupportedInspection();
}
}