1 package org.columba.addressbook.folder; 2 3 import org.columba.addressbook.folder.virtual.VirtualFolder; 4 import org.columba.addressbook.model.ContactModel; 5 import org.columba.addressbook.model.EmailModel; 6 import org.columba.addressbook.model.IContactModel; 7 8 public class VirtualFolderContactTest extends AbstractFolderTstCase { 9 10 public VirtualFolderContactTest(String arg0) { 11 super(arg0); 12 } 13 14 15 public void testAdd() throws Exception { 16 ContactModel c = new ContactModel(); 17 18 c.setNickName("nickname"); 19 c.addEmail(new EmailModel("name@mail.com", EmailModel.TYPE_HOME)); 20 String parentId = getSourceFolder().add(c); 21 22 VirtualFolder vf = new VirtualFolder(); 23 24 String id = vf.add(getSourceFolder(), parentId); 25 26 IContactModel c2 = vf.get(id); 27 28 assertEquals("nickname", c2.getNickName()); 29 } 30 31 public void testModify() throws Exception { 32 ContactModel c = new ContactModel(); 33 34 c.setNickName("nickname"); 35 c.addEmail(new EmailModel("name@mail.com", EmailModel.TYPE_HOME)); 36 String parentId = getSourceFolder().add(c); 37 38 VirtualFolder vf = new VirtualFolder(); 39 40 String id = vf.add(getSourceFolder(), parentId); 41 42 ContactModel c1 = (ContactModel) vf.get(id); 43 c1.setNickName("new"); 44 vf.modify(id, c1); 45 46 IContactModel c2 = vf.get(id); 47 48 assertEquals("new", c2.getNickName()); 49 } 50 51 } 52 | Popular Tags |