public class ResolverContext extends ExecutionNotifier<ResolverException>
Modifier and Type | Class and Description |
---|---|
static class |
ResolverContext.Builder
Builds a new
ResolverContext instance. |
Constructor and Description |
---|
ResolverContext(String... startLocation)
Creates a new ResolverContext instance.
|
Modifier and Type | Method and Description |
---|---|
static ResolverContext.Builder |
builder(String... startLocation)
Returns a new ResolverContext builder.
|
int |
getMaxTries()
Returns the maximum attempts to resolve an input value before reporting failure.
|
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 |
setRandom(Random random)
Changes the random number generator used to resolve test cases.
|
<T> T |
tryUntil(Stream<Optional<T>> results)
Returns the first result that is present.
|
<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. |
protected ResolverException |
whenFailure(Throwable e)
Returns an exception to throw for the given failure.
|
error, getNotifier, setNotifier, warn
doFor, getLocation, resultFor, toString
public ResolverContext(String... startLocation)
protected ResolverException whenFailure(Throwable e)
whenFailure
in class ExecutionContext<ResolverException>
public void setRandom(Random random)
public Random getRandom()
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.ResolverSkipException
public <T> T tryUntil(Stream<Optional<T>> results) throws ResolverSkipException
maximum tries
have been
attempted unsuccessfully reports a failure. Otherwise, returns the result.ResolverSkipException
public static ResolverContext.Builder builder(String... startLocation)
Copyright © 2024 The Cornutum Project. All rights reserved.