<?xml version="1.0" encoding="UTF-8"?>
<test-data
    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[
duplicate single type imports
     ]]></description>
        <expected-problems>1</expected-problems>
        <code><![CDATA[
import java.io.File;
import java.util.*;
import java.io.File;
public class Foo {}
     ]]></code>
    </test-code>
    <test-code>
        <description><![CDATA[
duplicate wildcard imports
     ]]></description>
        <expected-problems>1</expected-problems>
        <code><![CDATA[
import java.io.*;
import java.io.*;
public class Foo {}
     ]]></code>
    </test-code>
    <test-code>
        <description><![CDATA[
single type import after wildcard import
     ]]></description>
        <expected-problems>1</expected-problems>
        <code><![CDATA[
import java.util.*;
import java.net.*;
import java.io.*;
import java.io.File;
public class Foo {}
     ]]></code>
    </test-code>
    <test-code>
        <description><![CDATA[
subpackage import, ok
     ]]></description>
        <expected-problems>0</expected-problems>
        <code><![CDATA[
import javax.servlet.*;
import javax.servlet.http.*;
public class Foo {}
     ]]></code>
    </test-code>
    <test-code>
        <description><![CDATA[
674394, disambiguation import should be allowed
     ]]></description>
        <expected-problems>0</expected-problems>
        <code><![CDATA[
import java.awt.*;
import java.util.*;
import java.util.List; //False positive

class Foo{
    Color color;
    List list;
    Set set;
}
     ]]></code>
    </test-code>
    <test-code>
        <description><![CDATA[
674394, disambiguation import because of conflict with java.lang
     ]]></description>
        <expected-problems>0</expected-problems>
        <code><![CDATA[
import foo.*;
import foo.System;  //False positive

class Foo {
    System system;  //No, I do not mean java.lang.System
}
     ]]></code>
    </test-code>
    <test-code>
        <description>#1306 False positive on duplicate when using static imports</description>
        <expected-problems>0</expected-problems>
        <code><![CDATA[
//import static org.hamcrest.Matchers.*;
//import static org.mockito.Matchers.any; // original problem - this is needed for disambiguation
//import static org.mockito.Matchers.*;

import static org.junit.Assert.*;
import static net.sourceforge.pmd.lang.java.rule.codestyle.CodeStyleRulesTest.*;
import static org.junit.Assert.assertTrue; // this import is neeeded for disambiguation - as ImportsRulesTest
                                           // defines assertTrue with the same signature, too.

public class DuplicateImports {
}
        ]]></code>
    </test-code>
    <test-code>
        <description>negative case - static on-demand imports</description>
        <expected-problems>1</expected-problems>
        <expected-linenumbers>2</expected-linenumbers>
        <code><![CDATA[
import static org.junit.Assert.*;
import static org.junit.Assert.assertTrue;

public class DuplicateImports {
}
        ]]></code>
    </test-code>
</test-data>
