Package org.approvej
Class ApprovalBuilder<T>
java.lang.Object
org.approvej.ApprovalBuilder<T>
- Type Parameters:
T- the type of the value to approve
A builder to configure an approval for a given value.
Optionally the value can be "scrubbed" of dynamic data (like timestamps or ID's).
The value will be printed (converted to String) using a Printer. By default,
the ObjectPrinter will be applied, which can be changed with the
printWith(Function).
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic <T> ApprovalBuilder<T> approve(T originalValue) Creates a new builder for the given value.scrubbedOf(UnaryOperator<T> scrubber) Applies the given scrubber to the current value.voidverify()Uses the DEFAULT_VERIFIER to approve the printedvalue.void
-
Field Details
-
DEFAULT_PRINTER
The defaultPrinterused to print the value.
-
-
Method Details
-
approve
Creates a new builder for the given value.- Type Parameters:
T- the type of the value to approve- Parameters:
originalValue- the value to approve- Returns:
- a new
ApprovalBuilderfor the given value
-
printWith
- Parameters:
printer- the printer used to convert the value to aString- Returns:
- this
-
scrubbedOf
Applies the given scrubber to the current value.- Parameters:
scrubber- theUnaryOperatororScrubber- Returns:
- this
-
verify
- Parameters:
verifier- theConsumerorVerifier- Throws:
ApprovalError- if the verification fails
-
verify
public void verify()Uses the DEFAULT_VERIFIER to approve the printedvalue.- Throws:
ApprovalError- if the verification fails
-