<?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[
appending single character string, should fail
     ]]></description>
        <expected-problems>1</expected-problems>
        <code><![CDATA[
public class Foo {
 public void bar(StringBuffer sb) {
  sb.append("a");
 }
}
     ]]></code>
    </test-code>
    <test-code>
        <description><![CDATA[
appending single char, should be ok
     ]]></description>
        <expected-problems>0</expected-problems>
        <code><![CDATA[
public class Foo {
 public void bar(StringBuffer sb) {
  sb.append('a');
 }
}
     ]]></code>
    </test-code>
    <test-code>
        <description><![CDATA[
this is probably wrong, but shouldn't fail
     ]]></description>
        <expected-problems>0</expected-problems>
        <code><![CDATA[
public class Foo {
 public void bar(StringBuffer sb) {
  sb.append("a" + "foo");
 }
}
     ]]></code>
    </test-code>
    <test-code>
        <description><![CDATA[
concatenates a three character int
     ]]></description>
        <expected-problems>0</expected-problems>
        <code><![CDATA[
public class Foo {
 public void bar(StringBuffer sb) {
  sb.append(123);
 }
}
     ]]></code>
    </test-code>
    <test-code>
        <description><![CDATA[
concatenates a string explicitly set to 1 character, not explicitly checking right now
     ]]></description>
        <expected-problems>0</expected-problems>
        <code><![CDATA[
public class Foo {
 public void bar(StringBuffer sb) {
  String str = "a";
  sb.append(str);
 }
}
     ]]></code>
    </test-code>
    <test-code>
        <description><![CDATA[
for statement
     ]]></description>
        <expected-problems>1</expected-problems>
        <code><![CDATA[
public class Foo {
 public void bar(StringBuffer sb) {
  for(int ix = 0; ix < 100; ix++) 
      sb.append("a");
 }
}
     ]]></code>
    </test-code>
    <test-code>
        <description><![CDATA[
concatenates an escaped character
     ]]></description>
        <expected-problems>1</expected-problems>
        <code><![CDATA[
public class Foo {
 public void bar(StringBuffer sb) {
  sb.append("\t");
 }
}
     ]]></code>
    </test-code>
    <test-code>
        <description><![CDATA[
concatenates all escaped characters
     ]]></description>
        <expected-problems>8</expected-problems>
        <code><![CDATA[
public class Foo {
 public void bar(StringBuffer sb) {
  sb.append("\n");
  sb.append("\t");
  sb.append("\b");
  sb.append("\r");
  sb.append("\f");
  sb.append("\\");
  sb.append("\'");
  sb.append("\"");
 }
}
     ]]></code>
    </test-code>
    <test-code>
        <description><![CDATA[
concatenates a single upper case
     ]]></description>
        <expected-problems>1</expected-problems>
        <code><![CDATA[
public class Foo {
 public void bar(StringBuffer sb) {
  sb.append("A");
 }
}
     ]]></code>
    </test-code>
    <test-code>
        <description><![CDATA[
concatenates a single number
     ]]></description>
        <expected-problems>1</expected-problems>
        <code><![CDATA[
public class Foo {
 public void bar(StringBuffer sb) {
  sb.append("3");
 }
}
     ]]></code>
    </test-code>
    <test-code>
        <description><![CDATA[
concatenates a single character &
     ]]></description>
        <expected-problems>1</expected-problems>
        <code><![CDATA[
public class Foo {
 public void bar(StringBuffer sb) {
  sb.append("&");
 }
}
     ]]></code>
    </test-code>
    <test-code>
        <description><![CDATA[
concatenates two characters
     ]]></description>
        <expected-problems>0</expected-problems>
        <code><![CDATA[
public class Foo {
 public void bar(StringBuffer sb) {
  sb.append("/t");
 }
}
     ]]></code>
    </test-code>
    <test-code>
        <description><![CDATA[
a single octal character
     ]]></description>
        <expected-problems>2</expected-problems>
        <code><![CDATA[
public class Foo {
 public void bar(StringBuffer sb) {
  sb.append("\12");
  sb.append("\123");
 }
}
     ]]></code>
    </test-code>
    <test-code>
        <description><![CDATA[
octal character in longer string
     ]]></description>
        <expected-problems>0</expected-problems>
        <code><![CDATA[
public class Foo {
 public void bar(StringBuffer sb) {
  sb.append("\1234");
 }
}
     ]]></code>
    </test-code>
</test-data>
