/*!a Test the occurancesOf() method . * * The test data for this test are :- * a) When the search data is the first entry * b) When the search data is the last entry * c) When the search data is the mid(unique) entry * d) When the search data has a matching value but not ref. * e) When the search data has multiple matches - mixture of ref / values * f) When the search data has no match at all. */ void testOccurancesOf() { const int testCount = 6 ; const char* prefix = "Test the occurancesOf(UtlContainable* cl); where cl " ; const char* Msgs[] = { \ "is the first entry ", \ "is the last entry and ref matches ", \ "is the mid entry and is unique ", \ "has a matching value but not reference ", \ "has multiple matches ", \ "has no match at all " \ } ; commonList.insertAt(3, commonContainables_Clone[4]) ; commonList.insertAt(5, commonContainables[4]) ; UtlString notExistCollectable("This cannot and willnot exist"); UtlContainable* searchValues[] = { \ commonContainables[0], commonContainables[commonEntriesCount -1], \ commonContainables[2], commonContainables_Clone[3], \ commonContainables[4], ¬ExistCollectable \ } ; int matchCount[] = { 1, 1, 1, 1, 3, 0 } ; for (int i = 0 ; i < testCount ; i++) { string msg ; TestUtilities::createMessage(2, &msg, prefix, Msgs[i]) ; int actual = commonList.occurrencesOf(searchValues[i]) ; CPPUNIT_ASSERT_EQUAL_MESSAGE(msg.data(), matchCount[i], actual) ; } } //testOccurancesOf