Class MockitoUtils

java.lang.Object
dev.voidframework.test.utils.MockitoUtils

public final class MockitoUtils extends Object
Mockito utility methods.
Since:
1.11.0
  • Method Details

    • spyLambda

      public static <C, L extends C> L spyLambda(Class<C> lambdaClassType, L lambda)
      Creates a spy of a real lambda function.
      Type Parameters:
      C - The type of the lambda class type
      L - The lambda type
      Parameters:
      lambdaClassType - The class of the lambda function to spy
      lambda - The lambda function to spy
      Returns:
      A spy of the provided lambda function
      Since:
      1.11.0
    • spyConsumer

      public static <C extends Consumer<?>> C spyConsumer(C consumer)
      Creates a spy of a real consumer.
      Type Parameters:
      C - The consumer type
      Parameters:
      consumer - The consumer to spy
      Returns:
      A spy of the provided consumer
      Since:
      1.11.0
    • spyBiConsumer

      public static <C extends BiConsumer<?, ?>> C spyBiConsumer(C biconsumer)
      Creates a spy of a real consumer that accept two parameters.
      Type Parameters:
      C - The consumer type
      Parameters:
      biconsumer - The consumer to spy
      Returns:
      A spy of the provided consumer
      Since:
      1.11.0
    • spyFunction

      public static <F extends Function<?, ?>> F spyFunction(F function)
      Creates a spy of a real function.
      Type Parameters:
      F - The function type
      Parameters:
      function - The function to spy
      Returns:
      A spy of the provided function
      Since:
      1.11.0
    • spyBiFunction

      public static <F extends BiFunction<?, ?, ?>> F spyBiFunction(F bifunction)
      Creates a spy of a real function that accept two parameters.
      Type Parameters:
      F - The function type
      Parameters:
      bifunction - The function to spy
      Returns:
      A spy of the provided function
      Since:
      1.11.0
    • spyPredicate

      public static <P extends Predicate<?>> P spyPredicate(P predicate)
      Creates a spy of a real predicate.
      Type Parameters:
      P - The predicate type
      Parameters:
      predicate - The predicate to spy
      Returns:
      A spy of the provided predicate
      Since:
      1.11.0
    • spyBiPredicate

      public static <P extends BiPredicate<?, ?>> P spyBiPredicate(P bipredicate)
      Creates a spy of a real predicate that accept two parameters.
      Type Parameters:
      P - The predicate type
      Parameters:
      bipredicate - The predicate to spy
      Returns:
      A spy of the provided predicate
      Since:
      1.11.0
    • spySupplier

      public static <S extends Supplier<?>> S spySupplier(S supplier)
      Creates a spy of a real supplier.
      Type Parameters:
      S - The supplier type
      Parameters:
      supplier - The supplier to spy
      Returns:
      A spy of the provided supplier
      Since:
      1.11.0