<?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 https://pmd.sourceforge.io/rule-tests_1_0_0.xsd">

    <code-fragment id="sets-UnsupportedExceptionWithModifyAsListRule-ok"><![CDATA[
    public class Foo {
        private void method(long aLong) {
            List<String> t   = Arrays.asList("a","b","c");
        }
    }
    ]]>
    </code-fragment>

    <test-code>
        <description>sets-UnsupportedExceptionWithModifyAsListRule-ok.</description>
        <expected-problems>0</expected-problems>
        <code-ref id="sets-UnsupportedExceptionWithModifyAsListRule-ok"/>
    </test-code>

    <code-fragment id="sets-UnsupportedExceptionWithModifyAsListRule-warn"><![CDATA[
    public class Foo {
        private void method1() {
            if (true) {
                List<String> list = Arrays.asList("a", "b", "c");
                list.add("d");
                list.remove("22");
                list.clear();
            }
            List<String> list = new ArrayList<String>();
            list.add("b");
            list.remove("b");
        }

        private void method2() {
            if (true) {
                List<String> list = Arrays.asList("a", "b", "c");
                list.add("d");
            }
            List<String> list = new ArrayList<String>();
            list.add("b");
        }
    }
    ]]>
    </code-fragment>

    <test-code>
        <description>sets-UnsupportedExceptionWithModifyAsListRule-warn.</description>
        <expected-problems>4</expected-problems>
        <expected-linenumbers>5,6,7,17</expected-linenumbers>
        <code-ref id="sets-UnsupportedExceptionWithModifyAsListRule-warn"/>
    </test-code>

</test-data>
