Skip to content

Conversation

@kail-is
Copy link
Contributor

@kail-is kail-is commented Sep 7, 2025

Summary

Add BigDecimalCombinableArbitrary wrapping Jqwik and Kotest BigDecimal arbitraries with precision/scale control enhancements following existing CombinableArbitrary pattern.

Description

Implemented BigDecimalCombinableArbitrary by wrapping existing BigDecimal arbitrary implementations from Jqwik and Kotest frameworks, adding precision/scale constraints and following established CombinableArbitrary patterns.

Added components:

  • BigDecimalCombinableArbitrary interface with precision/scale constraint methods
  • BigDecimalCombinableArbitraryDelegator for filter/null injection operations
  • JqwikBigDecimalCombinableArbitrary wrapping Arbitraries.bigDecimals()
  • KotestBigDecimalCombinableArbitrary wrapping Arb.bigDecimal() (fixed from incorrect Byte implementation)
  • Factory method CombinableArbitrary.bigDecimals() with ServiceLoader integration

Key features:

  • Standard numeric constraints: .positive(), .negative(), .nonZero(), .withRange(BigDecimal, BigDecimal)
  • Precision/Scale control: .withPrecision(int), .withScale(int), .normalized()
  • Specialized ranges: .percentage() (0.0-100.0), .score(min, max)
  • Last-method-wins behavior for constraint precedence (precision/scale constraints override previous ones)
  • Full integration with existing filter/map/unique operations

Usage example:

BigDecimal nonZeroDecimal = CombinableArbitrary.bigDecimals().nonZero().combined();
BigDecimal twoDecimalPlaces = CombinableArbitrary.bigDecimals().withScale(2).combined();
BigDecimal percentage = CombinableArbitrary.bigDecimals().percentage().withPrecision(3).combined();

How Has This Been Tested?

Added comprehensive test suite in BigDecimalCombinableArbitraryTest:

  • Basic constraint validation (positive, negative, nonZero, withRange)
  • Precision and scale constraint testing with various decimal configurations
  • Method chaining and last-method-wins precedence verification
  • Integration with filter/map/unique operations
  • Complex precision/scale constraint combinations and normalization
  • ServiceLoader integration testing for both Jqwik and Kotest implementations

Is the Document updated?

Documentation will be updated to include BigDecimalCombinableArbitrary usage examples alongside existing numeric arbitrary types, with special emphasis on precision/scale control and framework-specific implementations.

@kail-is
Copy link
Contributor Author

kail-is commented Dec 20, 2025

Closing in favor of #1261

  • combined all numeric CombinableArbitrary types (Float, Double, BigInteger, BigDecimal) into a single PR for cleaner review.

@kail-is kail-is closed this Dec 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant