Package org.instancio

Interface LenientMode<T>

Type Parameters:
T - the type of object to create
All Known Subinterfaces:
CartesianProductApi<T>, InstancioApi<T>, InstancioOfClassApi<T>, InstancioOfCollectionApi<C>

interface LenientMode<T>
Provides support for lenient mode.

Instancio supports two modes: strict and lenient, an idea inspired by Mockito's highly useful strict stubbing feature.

In strict mode, unused selectors will trigger an error. In lenient mode, unused selectors are ignored. By default, Instancio runs in strict mode. Strict mode can be disabled by invoking the lenient() method or using the Keys.MODE setting.

Since:
4.0.0
See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    Disables strict mode in which unused selectors trigger an error.
  • Method Details

    • lenient

      LenientMode<T> lenient()
      Disables strict mode in which unused selectors trigger an error. In lenient mode unused selectors are simply ignored.

      This method is a shorthand for:

      
       Example example = Instancio.of(Example.class)
           .withSetting(Keys.MODE, Mode.LENIENT)
           .create();
       
      Returns:
      API builder reference
      Since:
      4.0.0