Package org.assertj.core.api
Class ErrorCollector
- java.lang.Object
-
- org.assertj.core.api.ErrorCollector
-
public class ErrorCollector extends Object
Collects error messages of all AssertionErrors thrown by the proxied method.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static classErrorCollector.LastResult
-
Field Summary
Fields Modifier and Type Field Description private static StringCLASS_NAMEprivate List<Throwable>errorsstatic StringFIELD_NAMEprivate static StringINTERCEPT_METHOD_NAMEprivate ErrorCollector.LastResultlastResult
-
Constructor Summary
Constructors Constructor Description ErrorCollector()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddError(Throwable error)protected static voidcollectAssertionError(AssertionError error, ErrorCollector errorCollector)private static longcountErrorCollectorProxyCalls()List<Throwable>errors()static Objectintercept(ErrorCollector errorCollector, Object assertion, Callable<?> proxy, Method method, Object stub)private booleanisNestedErrorCollectorProxyCall()booleanwasSuccess()
-
-
-
Field Detail
-
FIELD_NAME
public static final String FIELD_NAME
- See Also:
- Constant Field Values
-
INTERCEPT_METHOD_NAME
private static final String INTERCEPT_METHOD_NAME
- See Also:
- Constant Field Values
-
CLASS_NAME
private static final String CLASS_NAME
-
lastResult
private final ErrorCollector.LastResult lastResult
-
-
Method Detail
-
intercept
@RuntimeType public static Object intercept(@FieldValue("errorCollector") ErrorCollector errorCollector, @This Object assertion, @SuperCall Callable<?> proxy, @SuperMethod(nullIfImpossible=true) Method method, @StubValue Object stub) throws Exception
- Parameters:
errorCollector- theErrorCollectorto gather assertions error for the assertion instanceassertion- The instance of the method, the this reference.proxy- A proxy to invoke the original method.method- A reference to the original method.stub- A default value for the return type. null for reference type and 0 for the corresponding primitive types.- Returns:
- the assertion result
- Throws:
Exception- may be thrown from the assertion proxy call
-
collectAssertionError
protected static void collectAssertionError(AssertionError error, ErrorCollector errorCollector)
-
addError
public void addError(Throwable error)
-
wasSuccess
public boolean wasSuccess()
-
isNestedErrorCollectorProxyCall
private boolean isNestedErrorCollectorProxyCall()
-
countErrorCollectorProxyCalls
private static long countErrorCollectorProxyCalls()
-
-