The CER test code generator creates a Java interface for each rule class, and an accessor method on the interface for each rule attribute.
This generated accessor method returns a CER AttributeValue, not the attribute's value directly. To obtain the value itself, you must call the .getValue() method on the AttributeValue.
If you forget to use .getValue() in a test, then your test will probably compile fine but fail to behave correctly when it is run.
public void getValueNotUsed() { final FlexibleRetirementYear flexibleRetirementYear = FlexibleRetirementYear_Factory.getFactory().newInstance( session); flexibleRetirementYear.retirementCause().specifyValue( "Reached statutory retirement age."); /** * Will not work - ageAtRetirement() is a calculator, not a * value. * * JUnit will report the message: * junit.framework.AssertionFailedError: expected:<65> but * was: <Value: 65> * * Remember to use .getValue() on each attribute calculator! */ assertEquals(65, flexibleRetirementYear.ageAtRetirement()); }
Note that in this example, the value of the AttributeValue shows as the String "Value: 65", rather than the number 65 (which is what .getValue() would have returned).