Class AssertionFailedErrorBuilder.ReasonBuilder
- java.lang.Object
-
- com.github.robtimus.junit.support.AssertionFailedErrorBuilder.ReasonBuilder
-
- Enclosing class:
- AssertionFailedErrorBuilder
public static final class AssertionFailedErrorBuilder.ReasonBuilder extends Object
A builder for the reason why the assertion failed.- Author:
- Rob Spoor
- Since:
- 2.0
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description AssertionFailedErrorBuilderformat()Sets the reason on theAssertionFailedErrorBuilderthat returned this object.AssertionFailedErrorBuilder.ReasonBuilderwithValue(Object value)Adds a single formatted value.AssertionFailedErrorBuilder.ReasonBuilderwithValues(Object... values)Adds multiple formatted values, separated by commas.AssertionFailedErrorBuilder.ReasonBuilderwithValues(Collection<?> values)Adds multiple formatted values, separated by commas.
-
-
-
Method Detail
-
withValue
public AssertionFailedErrorBuilder.ReasonBuilder withValue(Object value)
Adds a single formatted value. This value should match a single string place holder in the pattern used to create this object.- Parameters:
value- The value to add.- Returns:
- This object.
-
withValues
public AssertionFailedErrorBuilder.ReasonBuilder withValues(Object... values)
Adds multiple formatted values, separated by commas. These values should match a single string place holder in the pattern used to create this object.- Parameters:
values- The values to add.- Returns:
- This object.
-
withValues
public AssertionFailedErrorBuilder.ReasonBuilder withValues(Collection<?> values)
Adds multiple formatted values, separated by commas. These values should match a single string place holder in the pattern used to create this object.- Parameters:
values- The values to add.- Returns:
- This object.
- Throws:
NullPointerException- If the given collection isnull.
-
format
public AssertionFailedErrorBuilder format()
Sets the reason on theAssertionFailedErrorBuilderthat returned this object. The reason will be a formatted string using the format used to create this object and arguments added to this object.- Returns:
- The
AssertionFailedErrorBuilderthat returned this object. - Throws:
IllegalFormatException- If the formatted string could not be created.- See Also:
String.format(String, Object...)
-
-