1 package org.columba.core.tagging; 2 3 import java.io.File ; 4 import java.util.Iterator ; 5 6 import junit.framework.TestCase; 7 8 import org.columba.core.config.Config; 9 import org.columba.core.tagging.api.ITag; 10 11 public class TagManagerTest extends TestCase { 12 13 TagManager tm; 14 static String normalTagId = ""; 15 16 protected void setUp() throws Exception { 17 super.setUp(); 18 tm = new TagManager(); 19 } 20 21 protected void tearDown() throws Exception { 22 super.tearDown(); 23 } 24 25 28 public void testAddTag() { 29 ITag normalTag = tm.addTag("NormalTag"); 30 normalTagId = normalTag.getId(); 31 System.out.println("normalTagId = " + normalTagId); 32 } 33 34 37 public void testGetAllTags() { 38 boolean found = false; 39 for (Iterator <ITag> iter = tm.getAllTags(); iter.hasNext();) { 40 ITag tag = iter.next(); 41 System.out.println("tag = " + tag.getId() + " | " + tag.getName()); 42 if (tag.getName().equals("NormalTag")) { 43 found = true; 44 System.out.println("Found NormalTag"); 45 } 46 } 47 } 48 49 52 public void testGetTag() { 53 if (tm.getTag(normalTagId) == null) fail("NormalTag not found"); 55 else 56 System.out.println("NormalTag found"); 57 } 58 61 public void testRemoveTag() { 62 if (tm.getTag(normalTagId) == null) 63 fail("NormalTag should be there!"); 64 tm.removeTag(normalTagId); 65 if (tm.getTag(normalTagId) != null) 66 fail("NormalTag not deleted!"); 67 } 68 69 } 70 | Popular Tags |