mtedone / podam

PODAM - POjo DAta Mocker
https://mtedone.github.io/podam
MIT License
323 stars 750 forks source link

can't set value if property is a single letter with number #304

Closed leonchen83 closed 2 years ago

leonchen83 commented 2 years ago

reproduce code

public class Reproduce {
    public static void main(String[] args) {
        final PodamFactory f = new PodamFactoryImpl();
        TestPo v1 = f.manufacturePojo(TestPo.class);
        System.out.println(v1);
    }

    public static class TestPo {
        //
        private int v1;

        private byte v2;

        private long v3;

        private short v4;

        private String v5;

        private String name;

        public int getV1() {
            return v1;
        }

        public void setV1(int v1) {
            this.v1 = v1;
        }

        public byte getV2() {
            return v2;
        }

        public void setV2(byte v2) {
            this.v2 = v2;
        }

        public long getV3() {
            return v3;
        }

        public void setV3(long v3) {
            this.v3 = v3;
        }

        public short getV4() {
            return v4;
        }

        public void setV4(short v4) {
            this.v4 = v4;
        }

        public String getV5() {
            return v5;
        }

        public void setV5(String v5) {
            this.v5 = v5;
        }

        public String getName() {
            return name;
        }

        public void setName(String name) {
            this.name = name;
        }

        @Override
        public String toString() {
            return "TestPo{" +
                    "v1=" + v1 +
                    ", v2=" + v2 +
                    ", v3=" + v3 +
                    ", v4=" + v4 +
                    ", v5='" + v5 + '\'' +
                    ", name='" + name + '\'' +
                    '}';
        }
    }
}

console print

TestPo{v1=0, v2=0, v3=0, v4=0, v5='null', name='BQVoBPHT4d'}

you can see that only name set the random value and other properties is default value.

podam version

            <dependency>
                <artifactId>podam</artifactId>
                <version>7.2.9.RELEASE</version>
                <groupId>uk.co.jemos.podam</groupId>
            </dependency>
daivanov commented 2 years ago

Will be fixed in podam 7.2.10