public void testTagItem() throws Exception {
final CategoryItem root = getRepo().loadCategory( "/" );
root.addCategory( "TestTag", "nothing to see" );
CategoryItem tagItem1 = getRepo().loadCategory("TestTag");
assertNotNull(tagItem1);
assertEquals("TestTag", tagItem1.getName());
CategoryItem tagItem2 = getRepo().loadCategory("TestTag");
assertNotNull(tagItem2);
assertEquals("TestTag", tagItem2.getName());
assertEquals(tagItem1, tagItem2);
List originalCats = getRepo().loadCategory( "/" ).getChildTags(); //listCategoryNames();
assertTrue(originalCats.size() > 0);
CategoryItem rootCat = (CategoryItem) originalCats.get( 0 );
assertNotNull(rootCat.getName());
assertNotNull(rootCat.getFullPath());
root.addCategory( "FootestTagItem", "nothing" );
List cats = root.getChildTags();
assertEquals(originalCats.size() + 1, cats.size());
boolean found = false;
for ( Iterator iter = cats.iterator(); iter.hasNext(); ) {
CategoryItem element = (CategoryItem) iter.next();
if (element.getName().equals( "FootestTagItem" )) {
found = true; break;
}
}
assertTrue(found);