<?xml version="1.0" encoding="UTF-8"?>
<test-data>
    <test-code>
        <description><![CDATA[
OK, guard is here
     ]]></description>
        <expected-problems>0</expected-problems>
        <code><![CDATA[
public class Foo {
  private static final Logger logger = Logger.getLogger(Foo.class);

  private void foo() {
    if ( logger.isDebugEnabled() )
        logger.debug("Debug statement");
 }
}
     ]]></code>
    </test-code>
    <test-code>
        <description><![CDATA[
KO, missing guard 1
     ]]></description>
        <expected-problems>1</expected-problems>
        <code><![CDATA[
public class Foo {
  private static final Logger logger = Logger.getLogger(Foo.class);

  private void foo() {
        logger.debug("Debug statement" + "");
  }
}
     ]]></code>
    </test-code>
    <test-code>
        <description><![CDATA[
KO, missing guard 2
        ]]></description>
        <rule-property name="logLevels">debug,trace</rule-property>
        <rule-property name="guardsMethods">isDebugEnabled,isTraceEnabled</rule-property>
        <expected-problems>1</expected-problems>
        <code><![CDATA[
public class Foo {
  private static final Logger logger = Logger.getLogger(Foo.class);

  private void foo() {
        logger.debug("Debug statement" + "");
  }

  private void bar() {
        logger.info("No guard, but'is OK with properties configuration" + "");
  }

}
       ]]></code>
    </test-code>
    <test-code>
        <description>ok #1189 GuardLogStatementRule and GuardDebugLoggingRule broken for log4j2</description>
        <expected-problems>0</expected-problems>
        <code><![CDATA[
public class Test {
    public void test() {
        final Marker m = MarkerManager.getMarker(mymarker);
        if (logger.isDebugEnabled(m)) {
          logger.debug(m, message + "");
        }
        if (logger.isTraceEnabled(m)) {
          logger.trace(m, message + "");
        }
    }
}
        ]]></code>
    </test-code>
    <test-code>
        <description>violation - wrong guard #1189 GuardLogStatementRule and GuardDebugLoggingRule broken for log4j2</description>
        <expected-problems>2</expected-problems>
        <code><![CDATA[
public class Test {
    public void test() {
        final Marker m = MarkerManager.getMarker(mymarker);
        if (logger.isTraceEnabled(m)) { // should have been isDebugEnabled
          logger.debug(m, message + "");
        }
        if (logger.isDebugEnabled(m)) { // should have been isTraceEnabled
          logger.trace(m, message + "");
        }
    }
}
        ]]></code>
    </test-code>
</test-data>
