Approval.ApprovalBuilder

public static final class ApprovalBuilder<T>

A builder class for approvals. This is used to conveniently build new approvals for a specific type with custom reporters, converters, etc.

Parameters:
  • <T> – the type that will be approved by the the resulting approval object

Methods

build

public Approval<T> build()

Creates a new approval with configuration/options(reporters, converters, etc) that were set for this builder.

Returns:a new approval for the specified type with custom configuration if any

withConveter

public ApprovalBuilder<T> withConveter(Converter<T> converterToBeUsed)

Set the converter that will be used when building new approvals with this builder.

Parameters:
  • converterToBeUsed – the converter that will be used from the approval that will be built
Returns:

the same builder for chaining

See also: Converter

withPathMapper

public ApprovalBuilder<T> withPathMapper(PathMapper<T> pathMapperToBeUsed)

Set a path mapper that will be used when building the path for approval results.

Parameters:
  • pathMapperToBeUsed – the path mapper
Returns:

the same builder for chaining

withReporter

public ApprovalBuilder<T> withReporter(Reporter reporterToBeUsed)

Set the reporter that will be used when building new approvals with this builder.

Parameters:
  • reporterToBeUsed – the reporter that will be used from the approval that will be built
Returns:

the same builder for chaninig

See also: Reporter