public class ResolverContext extends ExecutionContext<ResolverException>
| Modifier and Type | Class and Description |
|---|---|
static class |
ResolverContext.Builder
Builds a new
ResolverContext instance. |
| Constructor and Description |
|---|
ResolverContext(Random random)
Creates a new ResolverContext instance.
|
| Modifier and Type | Method and Description |
|---|---|
static ResolverContext.Builder |
builder(Random random)
Returns a new ResolverContext builder.
|
void |
error(String reason,
String resolution)
Reports an error that would have resulted in an inconsistent or infeasible test case.
|
int |
getMaxTries()
Returns the maximum attempts to resolve an input value before reporting failure.
|
Notifier |
getNotifier()
Returns the notifier that reports conditions that occur when resolving a test case.
|
Random |
getRandom()
Returns the random number generator used to resolve test cases.
|
void |
setMaxTries(int maxTries)
Changes the maximum attempts to resolve an input value before reporting failure.
|
void |
setNotifier(Notifier notifier)
Changes the notifier that reports conditions that occur when resolving a test case.
|
void |
setRandom(Random random)
Changes the random number generator used to resolve test cases.
|
<T> T |
tryUntil(Supplier<Optional<T>> valueSupplier)
Repeats evaluation of the given
valueSupplier until a result is present or until
the maximum tries have been attempted. |
void |
warn(String reason)
Reports a condition that will affect the expected test cat.
|
protected ResolverException |
whenFailure(Exception e)
Returns an exception to throw for the given failure.
|
doFor, getLocation, resultFor, toStringpublic ResolverContext(Random random)
protected ResolverException whenFailure(Exception e)
whenFailure in class ExecutionContext<ResolverException>public void setRandom(Random random)
public Random getRandom()
public void setNotifier(Notifier notifier)
public Notifier getNotifier()
public void setMaxTries(int maxTries)
public int getMaxTries()
public <T> T tryUntil(Supplier<Optional<T>> valueSupplier) throws ResolverSkipException
valueSupplier until a result is present or until
the maximum tries have been attempted. If the no more attempts are possible,
reports a failure. Otherwise, returns the supplied result.ResolverSkipExceptionpublic void warn(String reason)
reason - A description of the conditionpublic void error(String reason, String resolution)
reason - A description of the problemresolution - A description of how the problem was resolvedpublic static ResolverContext.Builder builder(Random random)
Copyright © 2020 The Cornutum Project. All rights reserved.