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