<?xml version="1.0" encoding="UTF-8"?>
<test-data>
    <test-code>
        <description><![CDATA[
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>
        <expected-problems>0</expected-problems>
        <code><![CDATA[
import java.io.File;
public class Foo {
 private File file;
}
     ]]></code>
    </test-code>
    <test-code>
        <description><![CDATA[
2 unused single-type imports
     ]]></description>
        <expected-problems>2</expected-problems>
        <code><![CDATA[
import java.io.File;
import java.util.List;
public class Foo {
}
     ]]></code>
    </test-code>
    <test-code>
        <description><![CDATA[
1 used single type import
     ]]></description>
        <expected-problems>0</expected-problems>
        <code><![CDATA[
import java.security.AccessController;
public class Foo {
 public void foo() {
  AccessController.doPrivileged(null);
 }
}
     ]]></code>
    </test-code>
    <test-code>
        <description><![CDATA[
1 import stmt, used only in throws clause
     ]]></description>
        <expected-problems>0</expected-problems>
        <code><![CDATA[
import java.rmi.RemoteException;
public class Foo {
 public void foo() throws RemoteException {}
}
     ]]></code>
    </test-code>
    <test-code>
        <description><![CDATA[
for loop
     ]]></description>
        <expected-problems>0</expected-problems>
        <code><![CDATA[
import java.util.ArrayList;
public class Foo {
 public void foo(ArrayList list) {
  for (String s : list) {}
 }
}
     ]]></code>
     <source-type>java 1.5</source-type>
    </test-code>
    <test-code>
        <description><![CDATA[
Generics
     ]]></description>
        <expected-problems>0</expected-problems>
        <code><![CDATA[
import foo.TestInterfaceTwo;
public class Foo {
 private List<TestInterfaceTwo> x = new ArrayList<TestInterfaceTwo>();
}
     ]]></code>
     <source-type>java 1.5</source-type>
    </test-code>
    <test-code>
        <description><![CDATA[
Annotations
     ]]></description>
        <expected-problems>0</expected-problems>
        <code><![CDATA[
import foo.annotation.Retention;
import foo.annotation.RetentionPolicy;
@Retention(RetentionPolicy.RUNTIME)
public @interface Foo {
}
     ]]></code>
     <source-type>java 1.5</source-type>
    </test-code>
    <test-code>
        <description><![CDATA[
Annotations 2
     ]]></description>
        <expected-problems>0</expected-problems>
        <code><![CDATA[
import foo.FooAnnotation1;
import foo.FooAnnotation2;
@FooAnnotation1
@FooAnnotation2
public class Foo {}
     ]]></code>
     <source-type>java 1.5</source-type>
    </test-code>
    <test-code>
        <description><![CDATA[
import from default package
     ]]></description>
        <expected-problems>0</expected-problems>
        <code><![CDATA[
import Bar;
public class Foo {
 public Bar foo() {}
}
     ]]></code>
    </test-code>
    <test-code>
        <description><![CDATA[
import from default package
     ]]></description>
        <expected-problems>1</expected-problems>
        <code><![CDATA[
import Bar;
public class Foo {
 public void foo() {}
}
     ]]></code>
    </test-code>
    <test-code>
        <description><![CDATA[
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");
	}
}
     ]]></code>
     <source-type>java 1.5</source-type>
    </test-code>
    <test-code>
        <description><![CDATA[
Unused static import
     ]]></description>
        <expected-problems>1</expected-problems>
        <code><![CDATA[
import static com.foo.MyClass.staticMethod;
public class Foo {
	public Foo(){
	}
}
     ]]></code>
     <source-type>java 1.5</source-type>
    </test-code>
    <test-code>
        <description><![CDATA[
On demand import
     ]]></description>
        <expected-problems>0</expected-problems>
        <code><![CDATA[
import java.util.*;
public class Foo {
	List list = new ArrayList();
}
     ]]></code>
    </test-code>
    <test-code>
        <description><![CDATA[
imports used in javadoc comment
     ]]></description>
        <expected-problems>0</expected-problems>
        <code><![CDATA[
import java.util.ArrayList;
import java.util.Calendar;
import java.util.List;
import java.util.LinkedList;
import java.util.File;
public class Foo {
	/**
	 * {@linkplain  List list} 
	 * {@link  ArrayList  arraylist} 
	 * {@link  LinkedList} 
	 * {@value  Calendar#DATE} 
	 * @see File
	 */
	public void test() {}
}
     ]]></code>
    </test-code>

    <test-code>
         <description><![CDATA[
Bug 2606609 : False "UnusedImports" positive in package-info.java
        ]]></description>
        <expected-problems>0</expected-problems>
        <code><![CDATA[
@DefaultAnnotation(NonNull.class)
package net.sourceforge.pmd.test;

import edu.umd.cs.findbugs.annotations.DefaultAnnotation;
import edu.umd.cs.findbugs.annotations.NonNull;
     ]]></code>
    </test-code>

    <test-code>
        <description>bug #254 False+ : UnusedImport with Javadoc @link</description>
        <expected-problems>0</expected-problems>
        <code><![CDATA[
import java.util.ArrayList;
import java.util.Collections;
import java.util.NoSuchElementException;

public class Test {
    /**
     * {@link ArrayList#add(Object)}
     * @see Collections
     * @throws NoSuchElementException no such element
     */
    String[] getList() { }
}
        ]]></code>
    </test-code>
    <test-code>
        <description>#1181 unused import false positive if used as parameter in javadoc only.</description>
        <expected-problems>0</expected-problems>
        <code><![CDATA[
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.Vector;

public class Foo {
    /**
     * See here: {@link Collections#reverse(List, Collection)}
     * @see Collections#reverse(ArrayList, Vector)
     */
    public Object bar() {}
}
        ]]></code>
    </test-code>
    <test-code>
        <description>#1280 False Positive in UnusedImports when import used in javadoc</description>
        <expected-problems>0</expected-problems>
        <code><![CDATA[
import some.pack.SomeUtility;

public class Foo {
    /**
     * The {@link SomeUtility#someHelperMethod(String, test.SomeObject)} method does something.
     */
    public void someMethod() {
    }
}
        ]]></code>
    </test-code>
    <test-code>
        <description>#914 False +ve from UnusedImports with wildcard static imports</description>
        <expected-problems>0</expected-problems>
        <code><![CDATA[
import static org.junit.Assert.*;
import org.junit.Test;
import static java.lang.Math.*;

public class FooTest {
    @Test
    public void testStuff() {
        assertEquals( "a", "a" );
        assertFalse( false );
        assertTrue( true );
        assertNull( null );
    }
    public static void main(String[] args) {
        System.out.println(PI);
    }
}
        ]]></code>
    </test-code>
</test-data>
