Package de.bmiag.tapir.assertion.aop
Class AssertJAssertionProxyFactory
- java.lang.Object
-
- de.bmiag.tapir.assertion.aop.AssertJAssertionProxyFactory
-
@Component public class AssertJAssertionProxyFactory extends java.lang.Object
TheAssertJAssertionProxyFactory
is responsible for providing a proxy for AssertJ's Fluent API.- Since:
- 3.1.0
- Author:
- Oliver Libutzki <[email protected]>
- See Also:
AssertJAssertionMethodInterceptor
-
-
Constructor Summary
Constructors Constructor Description AssertJAssertionProxyFactory()
-
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 givenMethodInterceptor
.<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.
-
-
-
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 theAssertJAssertionMethodInterceptor
will re-query the value by callingtargetSupplier.get()
. TheAssertionError
is thrown when the given timeout is exceeded. When not passing a timeout, the decision is delegated toAssertJAssertionMethodInterceptor
.- Type Parameters:
T
- AspectJ Assert type- Parameters:
targetClass
- AspectJ Assert typetargetSupplier
- The supplier which supplies the value to be assertedtimeoutOptional
- 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 givenMethodInterceptor
.- Type Parameters:
T
- AspectJ Assert type- Parameters:
targetClass
- AspectJ Assert typemethodInterceptor
- the method interceptor to use- Returns:
- the proxied object of type targetClass
-
-