Another expectation class is ConstraintList. It is similar to the former ExpectationList but offers more flexibility by using constraint classes to check the validity of the actual parameters. Instead of a value you pass the according object which is then used to verify the actual value. The usage of the constraint classes is explained in the chapter about ChainingMockObjects.
ConstraintList <int> cl ("verifyValue", 0); cl.addExpected(new IsGreaterOrEqual<int>(10)); cl.addExpected(new IsLessOrEqual<int>(20)); cl.addActual(13); cl.addActual(23);
This constraint is valid for all actual parameters which are greater than or equal to 10.
This one is valid for all actual parameters which are less than or equal to 20.