<?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[
bad, new BigDecimal(.1)
     ]]></description>
        <expected-problems>1</expected-problems>
        <code><![CDATA[
public class Foo {
 void bar() {
  BigDecimal bd = new BigDecimal(.1);
 }
}
     ]]></code>
    </test-code>
    <test-code>
        <description><![CDATA[
ok, new BigDecimal(".1")
     ]]></description>
        <expected-problems>0</expected-problems>
        <code><![CDATA[
public class Foo {
 void bar() {
  BigDecimal bd = new BigDecimal(".1");
 }
}
     ]]></code>
    </test-code>
    <test-code>
        <description>ok, new BigDecimal(10)</description>
        <expected-problems>0</expected-problems>
        <code><![CDATA[
public class Foo {
 void bar() {
  BigDecimal bd = new BigDecimal(10);
 }
}
     ]]></code>
    </test-code>
    <test-code>
        <description><![CDATA[
bad, same as #1 but outside an initializer context
     ]]></description>
        <expected-problems>1</expected-problems>
        <code><![CDATA[
public class Foo {
 BigDecimal bar() {
  return new BigDecimal(1.0);
 }
}
     ]]></code>
    </test-code>
    <test-code>
        <description>#1187 double variable with AvoidDecimalLiteralsInBigDecimalConstructor</description>
        <expected-problems>8</expected-problems>
        <expected-linenumbers>4,8,11,14,18,22,25,28</expected-linenumbers>
        <code><![CDATA[
public class Foo {
    public void bar() {
        double d = 0.1;
        BigDecimal bd = new BigDecimal(d); // line 4
    }
    public void bar2() {
        float f = 0.1f;
        BigDecimal bd = new BigDecimal(f); // line 8
    }
    public BigDecimal bar3(double e) {
        return new BigDecimal(e); // line 11
    }
    public BigDecimal bar4(float g) {
        return new BigDecimal(g); // line 14
    }
    public void bar5() {
        Double h = 0.1;
        BigDecimal bd = new BigDecimal(h); // line 18
    }
    public void bar6() {
        Float k = 0.1f;
        BigDecimal bd = new BigDecimal(k); // line 22
    }
    public BigDecimal bar7(Double m) {
        return new BigDecimal(m); // line 25
    }
    public BigDecimal bar8(Float n) {
        return new BigDecimal(n); // line 28
    }
}
        ]]></code>
    </test-code>
</test-data>
