/** * Handles all the assciation dependecies. */ protected void countAssociationDep() { TopicAssocDep topicassocdep = new TopicAssocDep(tm); //HashMap assocTypes; //Print out the result. print("\n\n\n Association Dependencies: \n\n\n"); Iterator it = topicassocdep.getAssociations().iterator(); while (it.hasNext()) { String a = (String)it.next(); StringTokenizer st = new StringTokenizer(a, "$"); String string = st.nextToken(); print("\n\nThe association \"" + string + "\" has roles:\n"); while (st.hasMoreTokens()) { string = st.nextToken(); print("\"" + string+ "\"\n"); } print("and occurs " + topicassocdep.getNumberOfOccurrences(a) + " times\n"); } }//end of countAssociationDep
public void testTopicAssocDep() { TopicAssocDep test = new TopicAssocDep(tm); //Type checking assertTrue("check type (getAssociations()) with 'foo'", test.getAssociations() instanceof Collection); try { test = new TopicAssocDep(null); // test.getAssociationDependencies(); // traverse() is now executed in constructor fail("Should raise a NullPointerException"); } catch (NullPointerException e) { //Test succesfull } }