<?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[
returning a HashSet, bad
     ]]></description>
        <expected-problems>1</expected-problems>
        <code><![CDATA[
import java.util.HashSet;
public class Foo {
 HashSet foo() {
  return new HashSet();
 }
}
     ]]></code>
    </test-code>
    <test-code>
        <description><![CDATA[
returning a Map, OK
     ]]></description>
        <expected-problems>0</expected-problems>
        <code><![CDATA[
import java.util.Map;
import java.util.HashMap;
public class Foo {
 Map getFoo() {
  return new HashMap();
 }
}
     ]]></code>
    </test-code>
    <test-code>
        <description><![CDATA[
no problemo
     ]]></description>
        <expected-problems>0</expected-problems>
        <code><![CDATA[
public class Foo {
 void foo() {}
}
     ]]></code>
    </test-code>
    <test-code>
        <description><![CDATA[
returning a set
     ]]></description>
        <expected-problems>0</expected-problems>
        <code><![CDATA[
import java.util.*;
public class Foo {
 Set fooSet = new HashSet(); // OK
 Set foo() {
  return fooSet;
 }
}
     ]]></code>
    </test-code>
    <test-code>
        <description><![CDATA[
field declared of type HashSet
     ]]></description>
        <expected-problems>1</expected-problems>
        <code><![CDATA[
import java.util.HashSet;
public class Foo {
 HashSet fooSet = new HashSet(); // NOT OK
}
     ]]></code>
    </test-code>
    <test-code>
        <description><![CDATA[
field, return type both HashSet
     ]]></description>
        <expected-problems>2</expected-problems>
        <code><![CDATA[
import java.util.HashSet;
public class Foo {
 HashSet fooSet = new HashSet(); // NOT OK
 HashSet foo() { // NOT OK
  return fooSet;
 }
}
     ]]></code>
    </test-code>
    <test-code>
        <description><![CDATA[
two fields
     ]]></description>
        <expected-problems>2</expected-problems>
        <code><![CDATA[
import java.util.HashSet;
import java.util.HashMap;
public class Foo {
 HashSet fooSet = new HashSet();
 HashMap fooMap = new HashMap();
}
     ]]></code>
    </test-code>
    <test-code>
        <description><![CDATA[
method param is HashMap
     ]]></description>
        <expected-problems>1</expected-problems>
        <code><![CDATA[
import java.util.HashMap;
public class Foo {
 void foo(HashMap bar) {}
}
     ]]></code>
    </test-code>
    <test-code>
        <description><![CDATA[
Vector could be List
     ]]></description>
        <expected-problems>1</expected-problems>
        <code><![CDATA[
import java.util.*;
public class Foo {
 public void foo(Vector bar) {}
}
     ]]></code>
    </test-code>
    <test-code>
        <description><![CDATA[
ArrayList could be List
     ]]></description>
        <expected-problems>1</expected-problems>
        <code><![CDATA[
import java.util.*;
public class Foo {
 public void foo(ArrayList bar) {}
}
     ]]></code>
    </test-code>

    <test-code>
        <description>#938 False positive on LooseCoupling for overriding methods</description>
        <expected-problems>0</expected-problems>
        <code><![CDATA[
import java.util.LinkedHashMap;

public class Test {
    @Override
    public LinkedHashMap findGetters() {}
}
        ]]></code>
    </test-code>
</test-data>
