Skip to content

Commit

Permalink
[java] Remove unnecessary CDATA for UnusedImports tests
Browse files Browse the repository at this point in the history
  • Loading branch information
adangel committed Feb 13, 2020
1 parent 63fbfbd commit 1bba78c
Showing 1 changed file with 50 additions and 66 deletions.
Expand Up @@ -3,20 +3,18 @@
xmlns="http://pmd.sourceforge.net/rule-tests"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://pmd.sourceforge.net/rule-tests http://pmd.sourceforge.net/rule-tests_1_0_0.xsd">

<test-code>
<description><![CDATA[
simple unused single type import
]]></description>
<description>simple unused single type import</description>
<expected-problems>1</expected-problems>
<code><![CDATA[
import java.io.File;
public class Foo {}
]]></code>
</test-code>

<test-code>
<description><![CDATA[
one used single type import
]]></description>
<description>one used single type import</description>
<expected-problems>0</expected-problems>
<code><![CDATA[
import java.io.File;
Expand All @@ -25,10 +23,9 @@ public class Foo {
}
]]></code>
</test-code>

<test-code>
<description><![CDATA[
2 unused single-type imports
]]></description>
<description>2 unused single-type imports</description>
<expected-problems>2</expected-problems>
<code><![CDATA[
import java.io.File;
Expand All @@ -37,10 +34,9 @@ public class Foo {
}
]]></code>
</test-code>

<test-code>
<description><![CDATA[
1 used single type import
]]></description>
<description>1 used single type import</description>
<expected-problems>0</expected-problems>
<code><![CDATA[
import java.security.AccessController;
Expand All @@ -51,10 +47,9 @@ public class Foo {
}
]]></code>
</test-code>

<test-code>
<description><![CDATA[
1 import stmt, used only in throws clause
]]></description>
<description>1 import stmt, used only in throws clause</description>
<expected-problems>0</expected-problems>
<code><![CDATA[
import java.rmi.RemoteException;
Expand All @@ -63,10 +58,9 @@ public class Foo {
}
]]></code>
</test-code>

<test-code>
<description><![CDATA[
for loop
]]></description>
<description>for loop</description>
<expected-problems>0</expected-problems>
<code><![CDATA[
import java.util.ArrayList;
Expand All @@ -78,10 +72,9 @@ public class Foo {
]]></code>
<source-type>java 1.5</source-type>
</test-code>

<test-code>
<description><![CDATA[
Generics
]]></description>
<description>Generics</description>
<expected-problems>0</expected-problems>
<code><![CDATA[
import foo.TestInterfaceTwo;
Expand All @@ -91,10 +84,9 @@ public class Foo {
]]></code>
<source-type>java 1.5</source-type>
</test-code>

<test-code>
<description><![CDATA[
Generics 2
]]></description>
<description>Generics 2</description>
<expected-problems>0</expected-problems>
<code><![CDATA[
import java.util.Collection;
Expand All @@ -106,10 +98,9 @@ public class Foo {
]]></code>
<source-type>java 1.5</source-type>
</test-code>

<test-code>
<description><![CDATA[
Annotations
]]></description>
<description>Annotations</description>
<expected-problems>0</expected-problems>
<code><![CDATA[
import foo.annotation.Retention;
Expand All @@ -120,10 +111,9 @@ public @interface Foo {
]]></code>
<source-type>java 1.5</source-type>
</test-code>

<test-code>
<description><![CDATA[
Annotations 2
]]></description>
<description>Annotations 2</description>
<expected-problems>0</expected-problems>
<code><![CDATA[
import foo.FooAnnotation1;
Expand All @@ -134,10 +124,9 @@ public class Foo {}
]]></code>
<source-type>java 1.5</source-type>
</test-code>

<test-code>
<description><![CDATA[
import from default package
]]></description>
<description>import from default package</description>
<expected-problems>0</expected-problems>
<code><![CDATA[
import Bar;
Expand All @@ -146,10 +135,9 @@ public class Foo {
}
]]></code>
</test-code>

<test-code>
<description><![CDATA[
import from default package
]]></description>
<description>import from default package</description>
<expected-problems>1</expected-problems>
<code><![CDATA[
import Bar;
Expand All @@ -158,25 +146,23 @@ public class Foo {
}
]]></code>
</test-code>

<test-code>
<description><![CDATA[
Used static import
]]></description>
<description>Used static import</description>
<expected-problems>0</expected-problems>
<code><![CDATA[
import static com.foo.MyClass.staticMethod;
public class Foo {
public Foo(){
staticMethod("This is OK");
}
public Foo(){
staticMethod("This is OK");
}
}
]]></code>
<source-type>java 1.5</source-type>
</test-code>

<test-code>
<description><![CDATA[
Unused static import
]]></description>
<description>Unused static import</description>
<expected-problems>1</expected-problems>
<code><![CDATA[
import static com.foo.MyClass.staticMethod;
Expand All @@ -187,22 +173,20 @@ public class Foo {
]]></code>
<source-type>java 1.5</source-type>
</test-code>

<test-code>
<description><![CDATA[
On demand import
]]></description>
<description>On demand import</description>
<expected-problems>0</expected-problems>
<code><![CDATA[
import java.util.*;
public class Foo {
List list = new ArrayList();
List list = new ArrayList();
}
]]></code>
</test-code>

<test-code>
<description><![CDATA[
imports used in javadoc comment, see also bug #254
]]></description>
<description>imports used in javadoc comment, see also bug #254</description>
<expected-problems>0</expected-problems>
<code><![CDATA[
import java.util.ArrayList;
Expand All @@ -225,6 +209,7 @@ public class Foo {
}
]]></code>
</test-code>

<test-code>
<description>#1280 False Positive in UnusedImports when import used in javadoc</description>
<expected-problems>0</expected-problems>
Expand Down Expand Up @@ -258,9 +243,7 @@ public class Foo {
</test-code>

<test-code>
<description><![CDATA[
Bug 2606609 : False "UnusedImports" positive in package-info.java
]]></description>
<description>Bug 2606609 : False "UnusedImports" positive in package-info.java</description>
<expected-problems>0</expected-problems>
<code><![CDATA[
@DefaultAnnotation(NonNull.class)
Expand Down Expand Up @@ -289,6 +272,7 @@ public class Test {
}
]]></code>
</test-code>

<test-code>
<description>#1181 unused import false positive if used as parameter in javadoc only.</description>
<expected-problems>0</expected-problems>
Expand All @@ -308,6 +292,7 @@ public class Foo {
}
]]></code>
</test-code>

<test-code>
<description>#1280 False Positive in UnusedImports when import used in javadoc</description>
<expected-problems>0</expected-problems>
Expand All @@ -323,6 +308,7 @@ public class Foo {
}
]]></code>
</test-code>

<test-code>
<description>#914 False +ve from UnusedImports with wildcard static imports</description>
<expected-problems>0</expected-problems>
Expand Down Expand Up @@ -386,10 +372,10 @@ import foo.bar.Fixed_Values;
*/
public interface Interface {
/**
* @throws Under_Score_Exception
*/
void doSomething();
/**
* @throws Under_Score_Exception
*/
void doSomething();
}
]]></code>
Expand All @@ -405,7 +391,7 @@ public class Foo {
/**
* {@link Bar#doSomething(GroupLayout.Group)}
*/
*/
void doSomething();
}
]]></code>
Expand Down Expand Up @@ -517,7 +503,7 @@ public class VendingV2PaymentRequest {
}
]]></code>
</test-code>

<test-code>
<description>#2025 False Positive in UnusedImports for params when using @link with FQCN</description>
<expected-problems>0</expected-problems>
Expand All @@ -528,7 +514,7 @@ import spark.Request; // flaged, should not
* {@link foo.bar.MyController#startTransaction(Request)}
*/
public class VendingV2PaymentRequest {
}
}
]]></code>
</test-code>

Expand All @@ -552,10 +538,9 @@ public class Issue2016 {
}
]]></code>
</test-code>

<test-code>
<description><![CDATA[
resolve ambiguous static on-demand imports (#2277)
]]></description>
<description>resolve ambiguous static on-demand imports (#2277)</description>
<expected-problems>0</expected-problems>
<code><![CDATA[
import static java.lang.Integer.*;
Expand All @@ -576,6 +561,5 @@ public class Foo {
}
}
]]></code>
<source-type>java 1.5</source-type>
</test-code>
</test-data>

0 comments on commit 1bba78c

Please sign in to comment.