| ILOG JRules User Guide > Testing Rules with Rule Scenario Manager > Reference > Test Extractors and Operators > WORKING_MEMORY |
WORKING_MEMORY |
PREVIOUS |
Extracts the contents of the working memory.
The extracted value is a table of strings, and can be compared using the following operator:
Operator |
Compares |
|---|---|
MASK_EQUALS |
The extracted list of objects contains at least one that includes an element that matches an element in the test value list. |
The MASK_EQUALS operator compares the values of the elements in the working memory with the values of a test list of elements, if those elements exist in the working memory. The values of the elements in the test list are compared to the equivalent working memory values. If all test elements exist in the working memory and all test values are equal, then the test passes.
As an example, consider the following working memory:
<working-memory> <java-type> <int>0</int> </java-type> <java-type> <string>coucou</string> </java-type> <loan.Borrower> <name type="string">JohnDoe</name> <age type="int">0</age> <zipCode type="string">94040</zipCode> <SSN type="string">987654325</SSN> <latestBankruptcy type="loan.Bankruptcy"> <yearsAgo type="int">20</yearsAgo> </latestBankruptcy> </loan.Borrower> </working-memory>
The following two tests are created and applied to the above working memory:
<test extractor="WORKING_MEMORY" operator="MASK_EQUALS" type="RAW"> <loan.Borrower><zipCode>94040</zipCode></loan.Borrower> <java-type><string>coucou</string></java-type> </test>
and
<test extractor="WORKING_MEMORY" operator="MASK_EQUALS" type="RAW"> <loan.Borrower><zipCode>94041</zipCode></loan.Borrower> <java-type><string>coucou</string></java-type> </test>
The first test will pass but the second will fail, giving the following error message:
WORKING_MEMORY test failed. Was expected MASK_EQUALS : [<loan.Borrower> <zipCode>94041</zipCode> </loan.Borrower> , <java-type> <string>coucou</string> </java-type> ]. But found: [<java-type> <string>coucou</string> </java-type> , <java-type> <int>0</int> </java-type> , <loan.Borrower> <name>JohnDoe</name> <age>0</age> <zipCode>94040</zipCode> <SSN>987654325</SSN> <latestBankruptcy> <yearsAgo>20</yearsAgo> </latestBankruptcy> </loan.Borrower> ].
| Copyright © 1987-2008 ILOG S.A. All rights reserved. Legal terms. Documentation homepage. | PREVIOUS |