com.agical.rmock.core.match.constraint
Class ConstraintFactory

java.lang.Object
  extended by com.agical.rmock.core.match.constraint.ConstraintFactory

public class ConstraintFactory
extends java.lang.Object

(c) Agical AB 2005

Author:
joakim.ohlrogge

Field Summary
 Expression ANYTHING
          Always passes
 Expression AS_RECORDED
          Special expression to indicate that a recorded argument on this position should not be changed.
 ClassConstraintFactory clazz
          A factory with expressions for checking attributes of java.lang.Class objects.
 Expression FALSE
          Checks if the checked actual value is a boolen and false
 MethodConstraintFactory method
          A factory with expressions for checking methods.
 Expression NoChange
          Deprecated. Use AS_RECORDED instead
 Expression NOT_NULL
          Checks if the checked actual value is a boolen and not null.
 Expression NULL
          Passes if the checked actual value is null
 Expression TRUE
          Checks if the checked actual value is a boolen and true
 
Constructor Summary
ConstraintFactory()
           
 
Method Summary
 Expression containing(java.lang.String string)
          Passes if the actual string is containing the value of string
 Expression endingWith(java.lang.String string)
          Passes if the actual string ends with the value of string
 Expression eq(boolean ref)
          Passes if the reference is equal to the actual object.
 Expression eq(byte ref)
          Passes if the reference is equal to the actual object.
 Expression eq(char ref)
          Passes if the reference is equal to the actual object.
 Expression eq(double ref)
          Passes if the reference is equal to the actual object.
 Expression eq(float ref)
          Passes if the reference is equal to the actual object.
 Expression eq(int ref)
          Passes if the reference is equal to the actual object.
 Expression eq(long ref)
          Passes if the reference is equal to the actual object.
 Expression eq(java.lang.Object ref)
          Passes if the reference is equal to the actual object.
 Expression eq(short ref)
          Passes if the reference is equal to the actual object.
 Expression ge(byte ref)
          Passes if the actual is greater than or equal to the reference.
 Expression ge(char ref)
          Passes if the actual is greater than or equal to the reference.
 Expression ge(double ref)
          Passes if the actual is greater than or equal to the reference.
 Expression ge(float ref)
          Passes if the actual is greater than or equal to the reference.
 Expression ge(int ref)
          Passes if the actual is greater than or equal to the reference.
 Expression ge(long ref)
          Passes if the actual is greater than or equal to the reference.
 Expression ge(java.lang.Object ref)
          Passes if the actual is greater than or equal to the reference.
 Expression ge(short ref)
          Passes if the actual is greater than or equal to the reference.
 Expression gt(byte ref)
          Passes if the actual is greater than the reference.
 Expression gt(char ref)
          Passes if the actual is greater than the reference.
 Expression gt(double ref)
          Passes if the actual is greater than the reference.
 Expression gt(float ref)
          Passes if the actual is greater than the reference.
 Expression gt(int ref)
          Passes if the actual is greater than the reference.
 Expression gt(long ref)
          Passes if the actual is greater than the reference.
 Expression gt(java.lang.Object ref)
          Passes if the actual is greater than the reference.
 Expression gt(short ref)
          Passes if the actual is greater than the reference.
 Expression instanceOf(java.lang.Class clazz)
          Passes if the actual object is an instance of the class passed as the parameter clazz.
 Expression le(byte ref)
          Passes if the actual is less than or equal to the reference.
 Expression le(char ref)
          Passes if the actual is less than or equal to the reference.
 Expression le(double ref)
          Passes if the actual is less than or equal to the reference.
 Expression le(float ref)
          Passes if the actual is less than or equal to the reference.
 Expression le(int ref)
          Passes if the actual is less than or equal to the reference.
 Expression le(long ref)
          Passes if the actual is less than or equal to the reference.
 Expression le(java.lang.Object ref)
          Passes if the actual is less than or equal to the reference.
 Expression le(short ref)
          Passes if the actual is less than or equal to the reference.
 Expression lt(byte ref)
          Passes if the actual is less than the reference.
 Expression lt(char ref)
          Passes if the actual is less than the reference.
 Expression lt(double ref)
          Passes if the actual is less than the reference.
 Expression lt(float ref)
          Passes if the actual is less than the reference.
 Expression lt(int ref)
          Passes if the actual is less than the reference.
 Expression lt(long ref)
          Passes if the actual is less than the reference.
 Expression lt(java.lang.Object ref)
          Passes if the actual is less than the reference.
 Expression lt(short ref)
          Passes if the actual is less than the reference.
 Expression not(Expression expression)
          Inverts an expression
 Expression same(java.lang.Object ref)
          Passes if the actual object is the same reference as the ref object.
 Expression startingWith(java.lang.String string)
          Passes if the actual string begins with the value of string
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

AS_RECORDED

public final Expression AS_RECORDED
Special expression to indicate that a recorded argument on this position should not be changed. This is useful if for instance you want to modify the second argument of a recorded expectation but leave the first argument as it was recorded.


NoChange

public final Expression NoChange
Deprecated. Use AS_RECORDED instead
Special expression to indicate that a recorded argument on this position should not be changed. This is useful if for instance you want to modify the second argument of a recorded expectation but leave the first argument as it was recorded.


NULL

public final Expression NULL
Passes if the checked actual value is null


TRUE

public final Expression TRUE
Checks if the checked actual value is a boolen and true


FALSE

public final Expression FALSE
Checks if the checked actual value is a boolen and false


NOT_NULL

public final Expression NOT_NULL
Checks if the checked actual value is a boolen and not null. This is convenient way to specify the equivalent of not(NULL).


ANYTHING

public final Expression ANYTHING
Always passes


clazz

public final ClassConstraintFactory clazz
A factory with expressions for checking attributes of java.lang.Class objects. Especially useful in dynamic suites


method

public final MethodConstraintFactory method
A factory with expressions for checking methods.

Constructor Detail

ConstraintFactory

public ConstraintFactory()
Method Detail

same

public Expression same(java.lang.Object ref)
Passes if the actual object is the same reference as the ref object. actual == ref

Parameters:
ref - the reference to check against
Returns:
an expression that checks if the references of ref and actual are the same.

instanceOf

public Expression instanceOf(java.lang.Class clazz)
Passes if the actual object is an instance of the class passed as the parameter clazz.

Parameters:
clazz - The class to check if the actual object is an instance of.
Returns:
An expression that checks if clazz.assignableFrom(actual)

eq

public Expression eq(java.lang.Object ref)
Passes if the reference is equal to the actual object. ref.equals(actual)

Parameters:
ref - the reference to check against
Returns:
an expression that checks for equality

eq

public Expression eq(boolean ref)
Passes if the reference is equal to the actual object. ref.equals(actual)

Parameters:
ref - the reference to check against
Returns:
an expression that checks for equality

eq

public Expression eq(long ref)
Passes if the reference is equal to the actual object. ref.equals(actual)

Parameters:
ref - the reference to check against
Returns:
an expression that checks for equality

eq

public Expression eq(int ref)
Passes if the reference is equal to the actual object. ref.equals(actual)

Parameters:
ref - the reference to check against
Returns:
an expression that checks for equality

eq

public Expression eq(short ref)
Passes if the reference is equal to the actual object. ref.equals(actual)

Parameters:
ref - the reference to check against
Returns:
an expression that checks for equality

eq

public Expression eq(byte ref)
Passes if the reference is equal to the actual object. ref.equals(actual)

Parameters:
ref - the reference to check against
Returns:
an expression that checks for equality

eq

public Expression eq(double ref)
Passes if the reference is equal to the actual object. ref.equals(actual)

Parameters:
ref - the reference to check against
Returns:
an expression that checks for equality

eq

public Expression eq(float ref)
Passes if the reference is equal to the actual object. ref.equals(actual)

Parameters:
ref - the reference to check against
Returns:
an expression that checks for equality

eq

public Expression eq(char ref)
Passes if the reference is equal to the actual object. ref.equals(actual)

Parameters:
ref - the reference to check against
Returns:
an expression that checks for equality

gt

public Expression gt(java.lang.Object ref)
Passes if the actual is greater than the reference. actual > ref

Parameters:
ref - the reference to check against
Returns:
an expression that checks for greater than

gt

public Expression gt(long ref)
Passes if the actual is greater than the reference. actual > ref

Parameters:
ref - the reference to check against
Returns:
an expression that checks for greater than

gt

public Expression gt(int ref)
Passes if the actual is greater than the reference. actual > ref

Parameters:
ref - the reference to check against
Returns:
an expression that checks for greater than

gt

public Expression gt(short ref)
Passes if the actual is greater than the reference. actual > ref

Parameters:
ref - the reference to check against
Returns:
an expression that checks for greater than

gt

public Expression gt(byte ref)
Passes if the actual is greater than the reference. actual > ref

Parameters:
ref - the reference to check against
Returns:
an expression that checks for greater than

gt

public Expression gt(double ref)
Passes if the actual is greater than the reference. actual > ref

Parameters:
ref - the reference to check against
Returns:
an expression that checks for greater than

gt

public Expression gt(float ref)
Passes if the actual is greater than the reference. actual > ref

Parameters:
ref - the reference to check against
Returns:
an expression that checks for greater than

gt

public Expression gt(char ref)
Passes if the actual is greater than the reference. actual > ref

Parameters:
ref - the reference to check against
Returns:
an expression that checks for greater than

ge

public Expression ge(java.lang.Object ref)
Passes if the actual is greater than or equal to the reference. actual >= ref

Parameters:
ref - the reference to check against
Returns:
an expression that checks for greater than or equals

ge

public Expression ge(long ref)
Passes if the actual is greater than or equal to the reference. actual >= ref

Parameters:
ref - the reference to check against
Returns:
an expression that checks for greater than or equals

ge

public Expression ge(int ref)
Passes if the actual is greater than or equal to the reference. actual >= ref

Parameters:
ref - the reference to check against
Returns:
an expression that checks for greater than or equals

ge

public Expression ge(short ref)
Passes if the actual is greater than or equal to the reference. actual >= ref

Parameters:
ref - the reference to check against
Returns:
an expression that checks for greater than or equals

ge

public Expression ge(byte ref)
Passes if the actual is greater than or equal to the reference. actual >= ref

Parameters:
ref - the reference to check against
Returns:
an expression that checks for greater than or equals

ge

public Expression ge(double ref)
Passes if the actual is greater than or equal to the reference. actual >= ref

Parameters:
ref - the reference to check against
Returns:
an expression that checks for greater than or equals

ge

public Expression ge(float ref)
Passes if the actual is greater than or equal to the reference. actual >= ref

Parameters:
ref - the reference to check against
Returns:
an expression that checks for greater than or equals

ge

public Expression ge(char ref)
Passes if the actual is greater than or equal to the reference. actual >= ref

Parameters:
ref - the reference to check against
Returns:
an expression that checks for greater than or equals

lt

public Expression lt(java.lang.Object ref)
Passes if the actual is less than the reference. actual < ref

Parameters:
i - the reference to check against
Returns:
an exprsssion that checks for less than

lt

public Expression lt(long ref)
Passes if the actual is less than the reference. actual < ref

Parameters:
ref - the reference to check against
Returns:
an exprsssion that checks for less than

lt

public Expression lt(int ref)
Passes if the actual is less than the reference. actual < ref

Parameters:
ref - the reference to check against
Returns:
an exprsssion that checks for less than

lt

public Expression lt(short ref)
Passes if the actual is less than the reference. actual < ref

Parameters:
ref - the reference to check against
Returns:
an exprsssion that checks for less than

lt

public Expression lt(byte ref)
Passes if the actual is less than the reference. actual < ref

Parameters:
ref - the reference to check against
Returns:
an exprsssion that checks for less than

lt

public Expression lt(double ref)
Passes if the actual is less than the reference. actual < ref

Parameters:
ref - the reference to check against
Returns:
an exprsssion that checks for less than

lt

public Expression lt(float ref)
Passes if the actual is less than the reference. actual < ref

Parameters:
ref - the reference to check against
Returns:
an exprsssion that checks for less than

lt

public Expression lt(char ref)
Passes if the actual is less than the reference. actual < ref

Parameters:
ref - the reference to check against
Returns:
an exprsssion that checks for less than

le

public Expression le(java.lang.Object ref)
Passes if the actual is less than or equal to the reference. actual <= ref

Parameters:
ref - the reference to check against
Returns:
an exprsssion that checks for less than or equal to

le

public Expression le(long ref)
Passes if the actual is less than or equal to the reference. actual <= ref

Parameters:
ref - the reference to check against
Returns:
an exprsssion that checks for less than or equal to

le

public Expression le(int ref)
Passes if the actual is less than or equal to the reference. actual <= ref

Parameters:
ref - the reference to check against
Returns:
an exprsssion that checks for less than or equal to

le

public Expression le(short ref)
Passes if the actual is less than or equal to the reference. actual <= ref

Parameters:
ref - the reference to check against
Returns:
an exprsssion that checks for less than or equal to

le

public Expression le(byte ref)
Passes if the actual is less than or equal to the reference. actual <= ref

Parameters:
ref - the reference to check against
Returns:
an exprsssion that checks for less than or equal to

le

public Expression le(double ref)
Passes if the actual is less than or equal to the reference. actual <= ref

Parameters:
ref - the reference to check against
Returns:
an exprsssion that checks for less than or equal to

le

public Expression le(float ref)
Passes if the actual is less than or equal to the reference. actual <= ref

Parameters:
ref - the reference to check againsts
Returns:
an exprsssion that checks for less than or equal to

le

public Expression le(char ref)
Passes if the actual is less than or equal to the reference. actual <= ref

Parameters:
ref - the reference to check against
Returns:
an exprsssion that checks for less than or equal to

not

public Expression not(Expression expression)
Inverts an expression

Parameters:
expression - the expression to invert
Returns:
an exprsssion that inveerts another expression

containing

public Expression containing(java.lang.String string)
Passes if the actual string is containing the value of string

Parameters:
string - the String that the actual object must contain for this expression to pass
Returns:
An expression that checks if the actual object contains a String.

startingWith

public Expression startingWith(java.lang.String string)
Passes if the actual string begins with the value of string

Parameters:
string - the String that the actual object must begin with for this expression to pass
Returns:
An expression that checks if the actual object begins with the specified string.

endingWith

public Expression endingWith(java.lang.String string)
Passes if the actual string ends with the value of string

Parameters:
string - the String that the actual object must end with for this expression to pass
Returns:
An expression that checks if the actual object ends with the specified string.


Copyright © 2005-2008 Agical AB. All Rights Reserved.