<?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>Global class</description>
        <expected-problems>1</expected-problems>
        <code><![CDATA[
global class Foo {

}
        ]]></code>
    </test-code>

    <test-code>
        <description>Global interface</description>
        <expected-problems>1</expected-problems>
        <code><![CDATA[
global interface Foo {

}
        ]]></code>
    </test-code>

    <test-code>
        <description>Global method</description>
        <expected-problems>1</expected-problems>
        <expected-linenumbers>1</expected-linenumbers>
        <code><![CDATA[
global class Foo {
    global Integer bar() {
       // Note, the rule reports the whole class, since that's enough:
       // if a member is global, that class has to be global as well to be valid apex.
       // See also https://github.com/pmd/pmd/issues/2298
    }
}
        ]]></code>
    </test-code>

    <test-code>
        <description>Global inner interface</description>
        <expected-problems>1</expected-problems>
        <expected-linenumbers>1</expected-linenumbers>
        <code><![CDATA[
global class Foo {
    global interface Bar {
       // Note, the rule reports the whole class, since that's enough:
       // if a member is global, that class has to be global as well to be valid apex.
       // See also https://github.com/pmd/pmd/issues/2298
    }
}
        ]]></code>
    </test-code>

    <test-code>
        <description>#1348 [apex] AvoidGlobalModifierRule gives warning even when its a REST webservice - false positive</description>
        <expected-problems>0</expected-problems>
        <code><![CDATA[
@RestResource(urlMapping = '/partners/submit/*')
global class Generic_LoanCreation {
    @HttpPost
    global static void createLoanApplication() {
    }
}
        ]]></code>
    </test-code>

    <test-code>
        <description>#1348 [apex] AvoidGlobalModifierRule gives warning even when its a SOAP webservice - false positive</description>
        <expected-problems>0</expected-problems>
        <code><![CDATA[
global class Generic_LoanCreation {
    webservice static void createLoanApplication() {
    }
}
        ]]></code>
    </test-code>

    <test-code>
        <description>Simple public and non-global class</description>
        <expected-problems>0</expected-problems>
        <code><![CDATA[
public class myOuterClass {
   // Additional myOuterClass code here
   class myInnerClass {
     // myInnerClass code here
   }

   void myMethod() {
   }
}
        ]]></code>
    </test-code>
</test-data>
