Class MockAsFactory


  • public final class MockAsFactory
    extends java.lang.Object
    A provider of static factory methods for creating mocks with As support.
    Author:
    Fabrizio Giudici
    • Constructor Summary

      Constructors 
      Constructor Description
      MockAsFactory()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static <T extends As>
      T
      mockWithAs​(java.lang.Class<T> clazz)
      Creates a mock with Mockito that fully supports As.
      static <T extends As>
      T
      mockWithAs​(java.lang.Class<T> clazz, java.util.Collection<java.lang.Object> roles)
      Creates a mock with Mockito that fully supports As.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • MockAsFactory

        public MockAsFactory()
    • Method Detail

      • mockWithAs

        @Nonnull
        public static <T extends As> T mockWithAs​(@Nonnull
                                                  java.lang.Class<T> clazz)
        Creates a mock with Mockito that fully supports As.
        Parameters:
        clazz - the mock class
        Returns:
        the mock
        Since:
        3.2-ALPHA-3 (refactored)
      • mockWithAs

        @Nonnull
        public static <T extends As> T mockWithAs​(@Nonnull
                                                  java.lang.Class<T> clazz,
                                                  @Nonnull
                                                  java.util.Collection<java.lang.Object> roles)
        Creates a mock with Mockito that fully supports As. This method doesn't call OwnerRoleFactoryProvider.getInstance().
        Parameters:
        clazz - the mock class
        roles - a collection of roles or factories for roles
        Returns:
        the mock
        Since:
        3.2-ALPHA-3 (refactored)