Skip to content

@benas benas released this Mar 14, 2019 · 14 commits to master since this release

This major release fixes a couple of design issues that have been reported against v3. Random Beans used to provide several configuration options in preference to strategy interfaces allowing the user to customize key behaviours. This has been fixed in this major version. Three strategy interfaces have been introduced allowing to customize the internal behaviour of the randomization process:

  • ExclusionPolicy: Strategy interface for field/type exclusion (See #349)
  • ObjectFactory: Strategy interface for object creation (See #341)
  • RandomizerProvider: Strategy interface to provide randomizers for field/type (See #350)

Custom implementations can be provided through the newly added EasyRandomParameters API:

EasyRandomParameters parameters = new EasyRandomParameters()
        .objectFactory(new MyObjectFactory())
        .exclusionPolicy(new MyExclusionPolicy())
        .randomizerProvider(new MyRandomizerProvider());

EasyRandom easyRandom = new EasyRandom(parameters);

Migration guide

  • The base package has been renamed from io.github.benas to org.jeasy
  • The groupId of the project has been changed to org.jeasy
  • The artifactId random-beans has been renamed to easy-random-core
  • The artifactId random-beans-validation has been renamed to easy-random-bean-validation
  • The artifactId random-beans-randomizers has been renamed to easy-random-randomizers
  • io.github.benas.randombeans.api.EnhancedRandom class has been renamed to org.jeasy.random.EasyRandom
  • EnhancedRandomParameters has been renamed to EasyRandomParameters
  • The EnhancedRandomBuilder has been removed in favor of the fluent EasyRandomParameters API
  • The io.github.benas.randombeans.util.Constants class has been removed and all parameter default values are now defined in EasyRandomParameters
  • The io.github.benas.randombeans.util.Range class has been moved as an inner class of EasyRandomParameters
  • Excluded fields (var args) in the EasyRandom#nextObject method have been removed. Field exclusion must be defined through EasyRandomParameters
  • If you are migrating from v3.9, RandomizerContext#getType has been renamed to RandomizerContext#getTargetType
  • If you are migrating from v3.9, RandomizerContext#getRandomizationDepth has been renamed to RandomizerContext#getCurrentRandomizationDepth
  • All deprecated APIs have been removed

If you have any problem, please do not hesitate to open an issue and I would love to help!

I would like to thank all contributors for their help moving the project forward and making it better release after release!

Assets 2
You can’t perform that action at this time.