Class AssertJAssertionProxyFactory


  • @Component
    public class AssertJAssertionProxyFactory
    extends java.lang.Object
    The AssertJAssertionProxyFactory is responsible for providing a proxy for AssertJ's Fluent API.
    Since:
    3.1.0
    Author:
    Oliver Libutzki <[email protected]>
    See Also:
    AssertJAssertionMethodInterceptor
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      <T> T getAssertionProxy​(java.lang.Class<T> targetClass, AssertJAssertionMethodInterceptor<T> methodInterceptor)
      Returns a proxy for an AssertJ Assert object with the given MethodInterceptor.
      <T> T getAssertionProxy​(java.lang.Class<T> targetClass, java.util.function.Supplier<T> targetSupplier, java.util.Optional<java.lang.Long> timeoutOptional)
      Returns a proxy for an AssertJ Assert object.
      • Methods inherited from class java.lang.Object

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

      • AssertJAssertionProxyFactory

        public AssertJAssertionProxyFactory()
    • Method Detail

      • getAssertionProxy

        public <T> T getAssertionProxy​(java.lang.Class<T> targetClass,
                                       java.util.function.Supplier<T> targetSupplier,
                                       java.util.Optional<java.lang.Long> timeoutOptional)
        Returns a proxy for an AssertJ Assert object. Whenever an assertion fails the AssertJAssertionMethodInterceptor will re-query the value by calling targetSupplier.get(). The AssertionError is thrown when the given timeout is exceeded. When not passing a timeout, the decision is delegated to AssertJAssertionMethodInterceptor.
        Type Parameters:
        T - AspectJ Assert type
        Parameters:
        targetClass - AspectJ Assert type
        targetSupplier - The supplier which supplies the value to be asserted
        timeoutOptional - The optional timeout
        Returns:
        the proxied object of type targetClass
      • getAssertionProxy

        public <T> T getAssertionProxy​(java.lang.Class<T> targetClass,
                                       AssertJAssertionMethodInterceptor<T> methodInterceptor)
        Returns a proxy for an AssertJ Assert object with the given MethodInterceptor.
        Type Parameters:
        T - AspectJ Assert type
        Parameters:
        targetClass - AspectJ Assert type
        methodInterceptor - the method interceptor to use
        Returns:
        the proxied object of type targetClass