01: /*
02: * ProfileKeyTest.java
03: *
04: * This file is part of SQL Workbench/J, http://www.sql-workbench.net
05: *
06: * Copyright 2002-2008, Thomas Kellerer
07: * No part of this code maybe reused without the permission of the author
08: *
09: * To contact the author please send an email to: support@sql-workbench.net
10: *
11: */
12: package workbench.gui.profiles;
13:
14: /**
15: *
16: * @author support@sql-workbench.net
17: */
18: public class ProfileKeyTest extends junit.framework.TestCase {
19:
20: public ProfileKeyTest(String testName) {
21: super (testName);
22: }
23:
24: public void testCreate() {
25: ProfileKey key = new ProfileKey(" { Group } / ProfileName ");
26: assertEquals("Wrong group detected", "Group", key.getGroup());
27: assertEquals("Wrong name detected", "ProfileName", key
28: .getName());
29:
30: key = new ProfileKey("{Group}/ProfileName ");
31: assertEquals("Wrong group detected", "Group", key.getGroup());
32: assertEquals("Wrong name detected", "ProfileName", key
33: .getName());
34:
35: // Allow group definition without a slash
36: key = new ProfileKey("{Group}ProfileName ");
37: assertEquals("Wrong group detected", "Group", key.getGroup());
38: assertEquals("Wrong name detected", "ProfileName", key
39: .getName());
40: }
41:
42: public void testCompare() {
43: ProfileKey key1 = new ProfileKey("Profile1");
44: ProfileKey key2 = new ProfileKey("Profile1", "Default Group");
45: assertEquals(key1, key2);
46:
47: key1 = new ProfileKey("Profile1");
48: key2 = new ProfileKey("Profile1");
49: assertEquals(key1, key2);
50:
51: key1 = new ProfileKey("{DefaultGroup}/Profile1");
52: key2 = new ProfileKey("Profile1", "Other Group");
53: assertNotSame(key1, key2);
54:
55: key1 = new ProfileKey("Profile1", "Default Group");
56: key2 = new ProfileKey("Profile2", "Default Group");
57: assertNotSame(key1, key2);
58:
59: key1 = new ProfileKey("Profile1", "Default Group");
60: key2 = new ProfileKey("{ Default Group} / Profile1");
61: assertEquals(key1, key2);
62: }
63:
64: }
|