Copyright 2008 - 2010 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 CheckResult

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

public final class CheckResult
extends Object

An enumeration of the possible results after checking a property. A CheckResult may be in one of six states:

  1. Passed
  2. Proven
  3. Falsified
  4. Exhausted
  5. Exception executing the property
  6. Exception generating values to check the property


Field Summary
static Show<CheckResult> summary
          A rendering of a check result that summarises in one line.
static Show<CheckResult> summaryEx
          A rendering of a check result that summarises in one line but throws an exception in the result is a failure (falsified, property exception or generator exception).
 
Method Summary
 Option<List<Arg<?>>> args()
          Returns the arguments if the result is one of; proven, falsified or exception during property execution, otherwise, no arguments are returned.
 int discarded()
          Returns the number of discarded checks of the property in this result.
 Option<Throwable> exception()
          Returns the execption if the result is one of; exception during property execution or exception during argument value generation, otherwise, no exception are returned.
static CheckResult exhausted(int succeeded, int discarded)
          Returns a result that the property been exhausted in checking.
static CheckResult falsified(List<Arg<?>> args, int succeeded, int discarded)
          Returns a result that the property has been falsified.
static CheckResult genException(Throwable ex, int succeeded, int discarded)
          Returns a result that generating values to check the property threw an exception.
 boolean isExhausted()
          Returns true if this result is exhausted, false otherwise.
 boolean isFalsified()
          Returns true if this result is falsified, false otherwise.
 boolean isGenException()
          Returns true if this result is an exception during generating of values for property checking, false otherwise.
 boolean isPassed()
          Returns true if this result is passed, false otherwise.
 boolean isPropException()
          Returns true if this result is an exception during property execution, false otherwise.
 boolean isProven()
          Returns true if this result is proven, false otherwise.
static CheckResult passed(int succeeded, int discarded)
          Returns a result that the property has passed.
static CheckResult propException(List<Arg<?>> args, Throwable ex, int succeeded, int discarded)
          Returns a result that checking the property threw an exception.
static CheckResult proven(List<Arg<?>> args, int succeeded, int discarded)
          Returns a result that the property has been proven.
 int succeeded()
          Returns the number of succeeded checks of the property in this result.
static Show<CheckResult> summary(Show<Arg<?>> sa)
          A rendering of a check result that summarises in one line.
static Show<CheckResult> summaryEx(Show<Arg<?>> sa)
          A rendering of a check result that summarises in one line but throws an exception in the result is a failure (falsified, property exception or generator exception).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

summary

public static final Show<CheckResult> summary
A rendering of a check result that summarises in one line.


summaryEx

public static final Show<CheckResult> summaryEx
A rendering of a check result that summarises in one line but throws an exception in the result is a failure (falsified, property exception or generator exception).

Method Detail

passed

public static CheckResult passed(int succeeded,
                                 int discarded)
Returns a result that the property has passed.

Parameters:
succeeded - The number of checks that succeeded.
discarded - The number of checks that were discarded.
Returns:
A result that the property has passed.

proven

public static CheckResult proven(List<Arg<?>> args,
                                 int succeeded,
                                 int discarded)
Returns a result that the property has been proven.

Parameters:
args - The arguments used to prove the property.
succeeded - The number of checks that succeeded.
discarded - The number of checks that were discarded.
Returns:
A result that the property has been proven.

falsified

public static CheckResult falsified(List<Arg<?>> args,
                                    int succeeded,
                                    int discarded)
Returns a result that the property has been falsified.

Parameters:
args - The arguments used to falsify the property.
succeeded - The number of checks that succeeded.
discarded - The number of checks that were discarded.
Returns:
A result that the property has been falsified.

exhausted

public static CheckResult exhausted(int succeeded,
                                    int discarded)
Returns a result that the property been exhausted in checking.

Parameters:
succeeded - The number of checks that succeeded.
discarded - The number of checks that were discarded.
Returns:
A result that the property has been exhausted in checking.

propException

public static CheckResult propException(List<Arg<?>> args,
                                        Throwable ex,
                                        int succeeded,
                                        int discarded)
Returns a result that checking the property threw an exception.

Parameters:
args - The arguments used when the exception was thrown.
ex - The exception that was thrown.
succeeded - The number of checks that succeeded.
discarded - The number of checks that were discarded.
Returns:
A result that checking the property threw an exception.

genException

public static CheckResult genException(Throwable ex,
                                       int succeeded,
                                       int discarded)
Returns a result that generating values to check the property threw an exception.

Parameters:
ex - The exception that was thrown.
succeeded - The number of checks that succeeded.
discarded - The number of checks that were discarded.
Returns:
A result that generating values to check the property threw an exception.

isPassed

public boolean isPassed()
Returns true if this result is passed, false otherwise.

Returns:
true if this result is passed, false otherwise.

isProven

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

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

isFalsified

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

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

isExhausted

public boolean isExhausted()
Returns true if this result is exhausted, false otherwise.

Returns:
true if this result is exhausted, false otherwise.

isPropException

public boolean isPropException()
Returns true if this result is an exception during property execution, false otherwise.

Returns:
true if this result is an exception during property execution, false otherwise.

isGenException

public boolean isGenException()
Returns true if this result is an exception during generating of values for property checking, false otherwise.

Returns:
true if this result is an exception during generating of values for property checking, false otherwise.

args

public Option<List<Arg<?>>> args()
Returns the arguments if the result is one of; proven, falsified or exception during property execution, otherwise, no arguments are returned.

Returns:
The arguments if the result is one of; proven, falsified or exception during property execution, otherwise, no arguments are returned.

exception

public Option<Throwable> exception()
Returns the execption if the result is one of; exception during property execution or exception during argument value generation, otherwise, no exception are returned.

Returns:
The execption if the result is one of; exception during property execution or exception during argument value generation, otherwise, no exception are returned.

succeeded

public int succeeded()
Returns the number of succeeded checks of the property in this result.

Returns:
The number of succeeded checks of the property in this result.

discarded

public int discarded()
Returns the number of discarded checks of the property in this result.

Returns:
The number of discarded checks of the property in this result.

summary

public static Show<CheckResult> summary(Show<Arg<?>> sa)
A rendering of a check result that summarises in one line.

Parameters:
sa - The rendering of arguments.
Returns:
A rendering of a check result that summarises in one line.

summaryEx

public static Show<CheckResult> summaryEx(Show<Arg<?>> sa)
A rendering of a check result that summarises in one line but throws an exception in the result is a failure (falsified, property exception or generator exception).

Parameters:
sa - The rendering of arguments.
Returns:
A rendering of a check result that summarises in one line but throws an exception in the result is a failure (falsified, property exception or generator exception).

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

This software is released under an open source BSD licence.