Skip to content

BigDecimalRangeRandomizer constructor bug #519

@alexey-ivanov-official

Description

@alexey-ivanov-official

there is a bug in BigDecimalRangeRandomizer constructor method

    public BigDecimalRangeRandomizer(final Double min, final Double max, final Integer scale, final RoundingMode roundingMode) {
        delegate = new DoubleRangeRandomizer(min, max, scale); // <<< the scale passed to seed
        this.roundingMode = roundingMode;
    }

the scale parameter should be passed to this.scale, but instead it passed to DoubleRangeRandomizer constructor,
which dont deal with scale, but with the seed

public DoubleRangeRandomizer(final Double min, final Double max, final long seed)

the correct solution may looks like

    public BigDecimalRangeRandomizer(final Double min, final Double max, final Integer scale, final RoundingMode roundingMode) {
        delegate = new DoubleRangeRandomizer(min, max);
        this.scale = scale;
        this.roundingMode = roundingMode;
    }

affected version: 5.0.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions