Class MockitoValueProvider

java.lang.Object
nl.jqno.equalsverifier.internal.valueproviders.MockitoValueProvider
All Implemented Interfaces:
ValueProvider

public class MockitoValueProvider extends Object implements ValueProvider
Provider of mock prefabricated instances of classes. If Mockito is available on the classpath (or modulepath) of the project, will attempt to use that to construct instances of the given type.
  • Field Details

    • disable

      private final boolean disable
  • Constructor Details

    • MockitoValueProvider

      public MockitoValueProvider(boolean disable)
      Constructor.
      Parameters:
      disable - If true, this ValueProvider always returns Optional.empty().
  • Method Details

    • provide

      public <T> Optional<Tuple<T>> provide(TypeTag tag, Attributes attributes)
      Returns a tuple of two different prefabricated values of the specified type.
      Specified by:
      provide in interface ValueProvider
      Type Parameters:
      T - The returned tuple will have this generic type.
      Parameters:
      tag - A description of the desired type, including generic parameters.
      attributes - The attributes of the field that the provided values must be linked to.
      Returns:
      A tuple of two different values of the given type, or an empty Optional if none could be found.
    • buildMock

      private <T> T buildMock(Class<T> type, String fieldName, String color)