Copyright 2008 - 2009 Tony Morris, Runar Bjarnason, Tom Adams, Brad Clow, Ricky Clarkson, Nick Partridge, Jason Zaugg

This software is released under an open source BSD licence.

fj.test
Class Result

java.lang.Object
  extended by fj.test.Result

public final class Result
extends Object

The result of evaluating a property.


Method Summary
 Result addArg(Arg<?> a)
          Adds an argument to this result.
 Option<List<Arg<?>>> args()
          Returns the potential arguments associated with this result.
 Option<Throwable> exception()
          Returns the potential exception associated with this result.
static Result exception(List<Arg<?>> args, Throwable t)
          Returns an exception result.
 boolean failed()
          Returns true if this result is falsified or an exception; otherwise, false.
static Result falsified(List<Arg<?>> args)
          Returns a falsified result.
 boolean isException()
          Returns true if this result is an exception; otherwise, false.
 boolean isFalsified()
          Returns true if this result is falsified; otherwise, false.
 boolean isNoResult()
          Returns true if this result is no result; otherwise, false.
 boolean isProven()
          Returns true if this result is proven; otherwise, false.
 boolean isUnfalsified()
          Returns true if this result is unfalsified; otherwise, false.
static Result noResult()
          Returns a result representing no result.
static Result noResult(Option<Result> r)
          Returns a result from the given potential result.
 boolean passed()
          Returns true if this result is unfalsified or proven; otherwise, false.
static Result proven(List<Arg<?>> args)
          Returns a proven result.
 Result provenAsUnfalsified()
          If this result is proven, alter it to be unfalsified with the same arguments; otherwise, return this.
 Option<Result> toOption()
          Returns a potential result for this result.
static Result unfalsified(List<Arg<?>> args)
          Returns an unfalsified result.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

args

public Option<List<Arg<?>>> args()
Returns the potential arguments associated with this result. This will only have a value, if and only if !noResult() holds.

Returns:
The potential arguments associated with this result.

exception

public Option<Throwable> exception()
Returns the potential exception associated with this result. This will only have a value if and only if this result is an exception result.

Returns:
The potential exception associated with this result.

isUnfalsified

public boolean isUnfalsified()
Returns true if this result is unfalsified; otherwise, false.

Returns:
true if this result is unfalsified; otherwise, false.

isFalsified

public boolean isFalsified()
Returns true if this result is falsified; otherwise, false.

Returns:
true if this result is falsified; otherwise, false.

isProven

public boolean isProven()
Returns true if this result is proven; otherwise, false.

Returns:
true if this result is proven; otherwise, false.

isException

public boolean isException()
Returns true if this result is an exception; otherwise, false.

Returns:
true if this result is an exception; otherwise, false.

isNoResult

public boolean isNoResult()
Returns true if this result is no result; otherwise, false.

Returns:
true if this result is no result; otherwise, false.

failed

public boolean failed()
Returns true if this result is falsified or an exception; otherwise, false.

Returns:
true if this result is falsified or an exception; otherwise, false.

passed

public boolean passed()
Returns true if this result is unfalsified or proven; otherwise, false.

Returns:
true if this result is unfalsified or proven; otherwise, false.

provenAsUnfalsified

public Result provenAsUnfalsified()
If this result is proven, alter it to be unfalsified with the same arguments; otherwise, return this.

Returns:
If this result is proven, alter it to be unfalsified with the same arguments; otherwise, return this.

addArg

public Result addArg(Arg<?> a)
Adds an argument to this result.

Parameters:
a - The argument to add.
Returns:
A result with the new argument.

toOption

public Option<Result> toOption()
Returns a potential result for this result. This will have a value if this result is !noResult().

Returns:
A potential result for this result.

noResult

public static Result noResult(Option<Result> r)
Returns a result from the given potential result.

Parameters:
r - The potential result.
Returns:
The result that may be noResult().

noResult

public static Result noResult()
Returns a result representing no result.

Returns:
A result representing no result.

unfalsified

public static Result unfalsified(List<Arg<?>> args)
Returns an unfalsified result.

Parameters:
args - The arguments used during the failure of falsification.
Returns:
An unfalsified result.

falsified

public static Result falsified(List<Arg<?>> args)
Returns a falsified result.

Parameters:
args - The arguments used during falsification.
Returns:
A falsified result.

proven

public static Result proven(List<Arg<?>> args)
Returns a proven result.

Parameters:
args - The arguments used during proof.
Returns:
A proven result.

exception

public static Result exception(List<Arg<?>> args,
                               Throwable t)
Returns an exception result.

Parameters:
args - The arguments used when the exception occurred.
t - The exception that occurred.
Returns:
A exception result.

Copyright 2008 - 2009 Tony Morris, Runar Bjarnason, Tom Adams, Brad Clow, Ricky Clarkson, Nick Partridge, Jason Zaugg

This software is released under an open source BSD licence.