Преглед изворни кода

More deprecation fixes

Change-Id: If418fcbcafa64857e6a656bee08fef7399b6a2e3
Reviewed-on: http://gerrit.dmdirc.com/2280
Automatic-Compile: DMDirc Build Manager
Reviewed-by: Greg Holmes <greg@dmdirc.com>
tags/0.6.7rc1
Chris Smith пре 12 година
родитељ
комит
41304ccecb
39 измењених фајлова са 221 додато и 187 уклоњено
  1. 1
    0
      nbproject/project.properties
  2. 3
    3
      src/com/dmdirc/Main.java
  3. 26
    26
      test/com/dmdirc/ServerManagerTest.java
  4. 3
    1
      test/com/dmdirc/ServerTest.java
  5. 3
    2
      test/com/dmdirc/WritableFrameContainerTest.java
  6. 2
    1
      test/com/dmdirc/actions/ActionComponentChainTest.java
  7. 5
    4
      test/com/dmdirc/actions/ActionConditionTest.java
  8. 5
    3
      test/com/dmdirc/actions/ActionManagerTest.java
  9. 3
    2
      test/com/dmdirc/actions/ActionModelTest.java
  10. 6
    5
      test/com/dmdirc/actions/ActionSubstitutorTest.java
  11. 3
    4
      test/com/dmdirc/actions/ActionTest.java
  12. 3
    2
      test/com/dmdirc/actions/wrappers/AliasWrapperTest.java
  13. 4
    3
      test/com/dmdirc/commandparser/CommandArgumentsTest.java
  14. 4
    2
      test/com/dmdirc/commandparser/commands/HelpTest.java
  15. 4
    3
      test/com/dmdirc/commandparser/commands/channel/BanTest.java
  16. 3
    2
      test/com/dmdirc/commandparser/commands/channel/KickReasonTest.java
  17. 1
    6
      test/com/dmdirc/commandparser/commands/channel/ModeTest.java
  18. 2
    7
      test/com/dmdirc/commandparser/commands/channel/NamesTest.java
  19. 2
    7
      test/com/dmdirc/commandparser/commands/channel/PartTest.java
  20. 4
    2
      test/com/dmdirc/commandparser/commands/channel/SetNickColourTest.java
  21. 4
    2
      test/com/dmdirc/commandparser/commands/chat/MeTest.java
  22. 16
    13
      test/com/dmdirc/commandparser/commands/flags/CommandFlagHandlerTest.java
  23. 3
    1
      test/com/dmdirc/commandparser/commands/global/AliasCommandTest.java
  24. 2
    1
      test/com/dmdirc/commandparser/commands/global/IfpluginTest.java
  25. 6
    4
      test/com/dmdirc/commandparser/commands/global/NewServerTest.java
  26. 3
    1
      test/com/dmdirc/commandparser/commands/server/ChangeServerTest.java
  27. 8
    6
      test/com/dmdirc/commandparser/parsers/GlobalCommandParserTest.java
  28. 9
    7
      test/com/dmdirc/config/CipherUtilsTest.java
  29. 5
    8
      test/com/dmdirc/config/prefs/PreferencesManagerTest.java
  30. 1
    1
      test/com/dmdirc/config/prefs/PreferencesSettingTest.java
  31. 7
    7
      test/com/dmdirc/config/validators/URLProtocolValidatorTest.java
  32. 7
    5
      test/com/dmdirc/logger/DMDircExceptionHandlerTest.java
  33. 12
    9
      test/com/dmdirc/logger/ProgramErrorTest.java
  34. 3
    2
      test/com/dmdirc/ui/WindowManagerTest.java
  35. 3
    2
      test/com/dmdirc/ui/messages/ColourManagerTest.java
  36. 11
    8
      test/com/dmdirc/ui/messages/IntelligentLinkingTest.java
  37. 24
    20
      test/com/dmdirc/ui/messages/StyliserStylesTest.java
  38. 4
    1
      test/com/dmdirc/ui/messages/StyliserTest.java
  39. 6
    4
      test/com/dmdirc/updater/UpdateTest.java

+ 1
- 0
nbproject/project.properties Прегледај датотеку

@@ -10,6 +10,7 @@ auxiliary.org-netbeans-modules-editor-indent.CodeStyle.project.text-limit-width=
10 10
 auxiliary.org-netbeans-modules-editor-indent.CodeStyle.project.text-line-wrap=none
11 11
 auxiliary.org-netbeans-modules-editor-indent.CodeStyle.usedProfile=project
12 12
 auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.allowConvertToStarImport=false
13
+auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.countForUsingStaticStarImport=1
13 14
 auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.importGroupsOrder=com.dmdirc;java;javax;org;*;static *
14 15
 auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.separateStaticImports=true
15 16
 endorsed.classpath=

+ 3
- 3
src/com/dmdirc/Main.java Прегледај датотеку

@@ -108,12 +108,12 @@ public final class Main {
108 108
         // Enable finer debugging for specific components like so:
109 109
         //java.util.logging.Logger.getLogger("com.dmdirc.plugins").setLevel(Level.ALL);
110 110
 
111
-        IdentityManager.loadVersion();
111
+        IdentityManager.getIdentityManager().loadVersionIdentity();
112 112
 
113 113
         final CommandLineParser clp = new CommandLineParser(args);
114 114
 
115 115
         try {
116
-            IdentityManager.load();
116
+            IdentityManager.getIdentityManager().initialise();
117 117
         } catch (InvalidIdentityFileException iife) {
118 118
             handleInvalidConfigFile();
119 119
         }
@@ -231,7 +231,7 @@ public final class Main {
231 231
 
232 232
         if (configFile.renameTo(newConfigFile)) {
233 233
             try {
234
-                IdentityManager.load();
234
+                IdentityManager.getIdentityManager().initialise();
235 235
             } catch (InvalidIdentityFileException iife2) {
236 236
                 // This shouldn't happen!
237 237
                 Logger.appError(ErrorLevel.FATAL, "Unable to load global config", iife2);

+ 26
- 26
test/com/dmdirc/ServerManagerTest.java Прегледај датотеку

@@ -23,21 +23,21 @@
23 23
 package com.dmdirc;
24 24
 
25 25
 import com.dmdirc.config.IdentityManager;
26
-import com.dmdirc.addons.ui_dummy.DummyController;
27 26
 import com.dmdirc.parser.common.ChannelJoinRequest;
28 27
 import com.dmdirc.plugins.PluginManager;
29 28
 
30 29
 import org.junit.After;
31 30
 import org.junit.BeforeClass;
32 31
 import org.junit.Test;
32
+
33 33
 import static org.junit.Assert.*;
34 34
 import static org.mockito.Mockito.*;
35 35
 
36 36
 public class ServerManagerTest {
37
-        
37
+
38 38
     @BeforeClass
39 39
     public static void setUp() throws Exception {
40
-        IdentityManager.load();
40
+        IdentityManager.getIdentityManager().initialise();
41 41
         Main.ensureExists(PluginManager.getPluginManager(), "tabcompletion");
42 42
     }
43 43
 
@@ -47,28 +47,28 @@ public class ServerManagerTest {
47 47
             ServerManager.getServerManager().unregisterServer(server);
48 48
         }
49 49
     }
50
-    
50
+
51 51
     @Test
52 52
     public void testGetServerManager() {
53 53
         final ServerManager resultA = ServerManager.getServerManager();
54 54
         final ServerManager resultB = ServerManager.getServerManager();
55
-        
55
+
56 56
         assertNotNull(resultA);
57 57
         assertTrue(resultA instanceof ServerManager);
58 58
         assertEquals(resultA, resultB);
59 59
     }
60
-    
60
+
61 61
     @Test
62 62
     public void testRegisterServer() {
63 63
         final Server server = mock(Server.class);
64
-        
64
+
65 65
         final ServerManager instance = ServerManager.getServerManager();
66 66
 
67 67
         instance.registerServer(server);
68
-        
68
+
69 69
         assertEquals(1, instance.numServers());
70 70
     }
71
-    
71
+
72 72
     @Test
73 73
     public void testUnregisterServer() {
74 74
         final Server server = mock(Server.class);
@@ -77,44 +77,44 @@ public class ServerManagerTest {
77 77
 
78 78
         instance.registerServer(server);
79 79
         instance.unregisterServer(server);
80
-        
80
+
81 81
         assertEquals(0, instance.numServers());
82 82
     }
83
-    
83
+
84 84
     @Test
85 85
     public void testNumServers() {
86 86
         final ServerManager instance = ServerManager.getServerManager();
87
-        
87
+
88 88
         assertEquals(instance.getServers().size(), instance.numServers());
89
-        
89
+
90 90
         final Server server = mock(Server.class);
91 91
 
92 92
         instance.registerServer(server);
93
-        
93
+
94 94
         assertEquals(instance.getServers().size(), instance.numServers());
95
-        
95
+
96 96
         instance.unregisterServer(server);
97
-        
97
+
98 98
         assertEquals(instance.getServers().size(), instance.numServers());
99 99
     }
100
-        
100
+
101 101
     @Test
102 102
     public void testGetServerByAddress() {
103 103
         final Server serverA = mock(Server.class);
104 104
         final Server serverB = mock(Server.class);
105 105
         when(serverA.getAddress()).thenReturn("255.255.255.255");
106 106
         when(serverB.getAddress()).thenReturn("255.255.255.254");
107
-        
107
+
108 108
         final ServerManager sm = ServerManager.getServerManager();
109 109
 
110 110
         sm.registerServer(serverA);
111 111
         sm.registerServer(serverB);
112
-        
112
+
113 113
         assertEquals(serverA, sm.getServersByAddress("255.255.255.255").get(0));
114 114
         assertEquals(serverB, sm.getServersByAddress("255.255.255.254").get(0));
115 115
         assertEquals(0, sm.getServersByAddress("255.255.255.253").size());
116
-    }    
117
-    
116
+    }
117
+
118 118
     @Test
119 119
     public void testGetServerByNetwork() throws InterruptedException {
120 120
         final Server serverA = mock(Server.class);
@@ -124,20 +124,20 @@ public class ServerManagerTest {
124 124
         when(serverA.isNetwork("Net1")).thenReturn(true);
125 125
         when(serverB.isNetwork("Net2")).thenReturn(true);
126 126
         when(serverC.isNetwork("Net2")).thenReturn(true);
127
-        
127
+
128 128
         final ServerManager sm = ServerManager.getServerManager();
129 129
 
130 130
         sm.registerServer(serverA);
131 131
         sm.registerServer(serverB);
132 132
         sm.registerServer(serverC);
133
-        
133
+
134 134
         assertEquals(1, sm.getServersByNetwork("Net1").size());
135 135
         assertEquals(serverA, sm.getServersByNetwork("Net1").get(0));
136
-        
136
+
137 137
         assertEquals(2, sm.getServersByNetwork("Net2").size());
138 138
         assertEquals(serverB, sm.getServersByNetwork("Net2").get(0));
139 139
         assertEquals(serverC, sm.getServersByNetwork("Net2").get(1));
140
-        
140
+
141 141
         assertEquals(0, sm.getServersByNetwork("Net3").size());
142 142
     }
143 143
 
@@ -210,5 +210,5 @@ public class ServerManagerTest {
210 210
 
211 211
         assertEquals(3, ServerManager.getServerManager().numServers());
212 212
     }
213
-    
213
+
214 214
 }

+ 3
- 1
test/com/dmdirc/ServerTest.java Прегледај датотеку

@@ -25,8 +25,10 @@ package com.dmdirc;
25 25
 import com.dmdirc.config.IdentityManager;
26 26
 
27 27
 import java.net.URI;
28
+
28 29
 import org.junit.BeforeClass;
29 30
 import org.junit.Test;
31
+
30 32
 import static org.junit.Assert.*;
31 33
 
32 34
 public class ServerTest {
@@ -36,7 +38,7 @@ public class ServerTest {
36 38
     @BeforeClass
37 39
     public static void setUp() throws Exception {
38 40
         Main.extractCorePlugins("tabcompletion_");
39
-        IdentityManager.load();
41
+        IdentityManager.getIdentityManager().initialise();
40 42
         server = new Server(new URI("irc-test://255.255.255.255"),
41 43
                 IdentityManager.getCustomIdentities("profile").get(0));
42 44
         server.connect();

+ 3
- 2
test/com/dmdirc/WritableFrameContainerTest.java Прегледај датотеку

@@ -25,18 +25,19 @@ package com.dmdirc;
25 25
 import com.dmdirc.config.IdentityManager;
26 26
 import com.dmdirc.config.InvalidIdentityFileException;
27 27
 import com.dmdirc.harness.TestWritableFrameContainer;
28
-import com.dmdirc.interfaces.ui.InputWindow;
29 28
 
30 29
 import java.util.Arrays;
30
+
31 31
 import org.junit.BeforeClass;
32 32
 import org.junit.Test;
33
+
33 34
 import static org.junit.Assert.*;
34 35
 
35 36
 public class WritableFrameContainerTest {
36 37
 
37 38
     @BeforeClass
38 39
     public static void setupClass() throws InvalidIdentityFileException {
39
-        IdentityManager.load();
40
+        IdentityManager.getIdentityManager().initialise();
40 41
     }
41 42
 
42 43
     @Test

+ 2
- 1
test/com/dmdirc/actions/ActionComponentChainTest.java Прегледај датотеку

@@ -27,13 +27,14 @@ import com.dmdirc.config.IdentityManager;
27 27
 
28 28
 import org.junit.BeforeClass;
29 29
 import org.junit.Test;
30
+
30 31
 import static org.junit.Assert.*;
31 32
 
32 33
 public class ActionComponentChainTest {
33 34
 
34 35
     @BeforeClass
35 36
     public static void setUp() throws Exception {
36
-        IdentityManager.load();
37
+        IdentityManager.getIdentityManager().initialise();
37 38
         ActionManager.getActionManager().initialise();
38 39
     }
39 40
 

+ 5
- 4
test/com/dmdirc/actions/ActionConditionTest.java Прегледај датотеку

@@ -26,13 +26,14 @@ import com.dmdirc.config.IdentityManager;
26 26
 
27 27
 import org.junit.BeforeClass;
28 28
 import org.junit.Test;
29
+
29 30
 import static org.junit.Assert.*;
30 31
 
31 32
 public class ActionConditionTest {
32 33
 
33 34
     @BeforeClass
34 35
     public static void setUp() throws Exception {
35
-        IdentityManager.load();
36
+        IdentityManager.getIdentityManager().initialise();
36 37
         ActionManager.getActionManager().initialise();
37 38
     }
38 39
 
@@ -91,7 +92,7 @@ public class ActionConditionTest {
91 92
         ac.setArg(0);
92 93
         assertEquals(0, ac.getArg());
93 94
     }
94
-    
95
+
95 96
     @Test
96 97
     public void testToString() {
97 98
         final ActionCondition ac1 = new ActionCondition("foobarbaz",
@@ -113,11 +114,11 @@ public class ActionConditionTest {
113 114
         assertFalse(ac1.equals(null));
114 115
         assertFalse(ac1.equals("foo"));
115 116
         assertEquals(ac1.hashCode(), ac2.hashCode());
116
-        
117
+
117 118
         ac2.setStarget("bar");
118 119
         assertFalse(ac2.equals(ac1));
119 120
         assertFalse(ac1.equals(ac2));
120
-        
121
+
121 122
         ac2.setStarget("foobarbaz");
122 123
         ac2.setComponent(CoreActionComponent.STRING_STRING);
123 124
         ac2.setArg(1);

+ 5
- 3
test/com/dmdirc/actions/ActionManagerTest.java Прегледај датотеку

@@ -21,21 +21,23 @@
21 21
  */
22 22
 package com.dmdirc.actions;
23 23
 
24
-import com.dmdirc.interfaces.actions.ActionType;
25 24
 import com.dmdirc.config.IdentityManager;
26
-import java.io.File;
25
+import com.dmdirc.interfaces.actions.ActionType;
27 26
 
27
+import java.io.File;
28 28
 import java.util.ArrayList;
29
+
29 30
 import org.junit.AfterClass;
30 31
 import org.junit.BeforeClass;
31 32
 import org.junit.Test;
33
+
32 34
 import static org.junit.Assert.*;
33 35
 
34 36
 public class ActionManagerTest {
35 37
 
36 38
     @BeforeClass
37 39
     public static void setUpClass() throws Exception {
38
-        IdentityManager.load();
40
+        IdentityManager.getIdentityManager().initialise();
39 41
         ActionManager.getActionManager().initialise();
40 42
         ActionManager.getActionManager().loadUserActions();
41 43
 

+ 3
- 2
test/com/dmdirc/actions/ActionModelTest.java Прегледај датотеку

@@ -22,9 +22,9 @@
22 22
 
23 23
 package com.dmdirc.actions;
24 24
 
25
-import com.dmdirc.interfaces.actions.ActionType;
26 25
 import com.dmdirc.config.IdentityManager;
27 26
 import com.dmdirc.config.InvalidIdentityFileException;
27
+import com.dmdirc.interfaces.actions.ActionType;
28 28
 
29 29
 import java.util.ArrayList;
30 30
 import java.util.Arrays;
@@ -32,13 +32,14 @@ import java.util.List;
32 32
 
33 33
 import org.junit.BeforeClass;
34 34
 import org.junit.Test;
35
+
35 36
 import static org.junit.Assert.*;
36 37
 
37 38
 public class ActionModelTest {
38 39
 
39 40
     @BeforeClass
40 41
     public static void setUpClass() throws InvalidIdentityFileException {
41
-        IdentityManager.load();
42
+        IdentityManager.getIdentityManager().initialise();
42 43
     }
43 44
 
44 45
     @Test

+ 6
- 5
test/com/dmdirc/actions/ActionSubstitutorTest.java Прегледај датотеку

@@ -39,14 +39,15 @@ import org.junit.BeforeClass;
39 39
 import org.junit.Test;
40 40
 import org.junit.runner.RunWith;
41 41
 import org.junit.runners.Parameterized;
42
-import static org.junit.Assert.*;
42
+
43
+import static org.junit.Assert.assertEquals;
43 44
 import static org.mockito.Mockito.*;
44 45
 
45 46
 @RunWith(Parameterized.class)
46 47
 public class ActionSubstitutorTest {
47 48
 
48 49
     private static final Map<String, String> SETTINGS = new HashMap<String, String>();
49
-    
50
+
50 51
     private final String input, expected;
51 52
     private final Channel channel;
52 53
     private final ActionSubstitutor substitutor;
@@ -54,7 +55,7 @@ public class ActionSubstitutorTest {
54 55
 
55 56
     @BeforeClass
56 57
     public static void setup() throws InvalidIdentityFileException {
57
-        IdentityManager.load();
58
+        IdentityManager.getIdentityManager().initialise();
58 59
         ActionManager.getActionManager().initialise();
59 60
 
60 61
         SETTINGS.put("alpha", "A");
@@ -69,7 +70,7 @@ public class ActionSubstitutorTest {
69 70
         this.expected = expected;
70 71
 
71 72
         this.channel = mock(Channel.class);
72
-        
73
+
73 74
         final ConfigManager manager = mock(ConfigManager.class);
74 75
         final Server server = mock(Server.class);
75 76
 
@@ -122,7 +123,7 @@ public class ActionSubstitutorTest {
122 123
             // ---- Combinations -----------------------------------------------
123 124
             {"${1}${2.STRING_LENGTH}$alpha", "128A"},
124 125
             {"$alpha$4${SERVER_MYAWAYREASON}", "Afourth_word_herefoo"},
125
-            
126
+
126 127
             // -- New behaviour ------------------------------------------------
127 128
             // ---- Config subs ------------------------------------------------
128 129
             {"${alpha}", "A"},

+ 3
- 4
test/com/dmdirc/actions/ActionTest.java Прегледај датотеку

@@ -21,11 +21,10 @@
21 21
  */
22 22
 package com.dmdirc.actions;
23 23
 
24
-import com.dmdirc.interfaces.actions.ActionType;
25
-
26 24
 import com.dmdirc.config.IdentityManager;
27 25
 import com.dmdirc.config.prefs.PreferencesSetting;
28 26
 import com.dmdirc.config.prefs.PreferencesType;
27
+import com.dmdirc.interfaces.actions.ActionType;
29 28
 import com.dmdirc.util.io.ConfigFile;
30 29
 import com.dmdirc.util.io.InvalidConfigFileException;
31 30
 
@@ -34,16 +33,16 @@ import java.io.IOException;
34 33
 import java.util.ArrayList;
35 34
 import java.util.Arrays;
36 35
 
37
-import org.junit.Before;
38 36
 import org.junit.BeforeClass;
39 37
 import org.junit.Test;
38
+
40 39
 import static org.junit.Assert.*;
41 40
 
42 41
 public class ActionTest {
43 42
 
44 43
     @BeforeClass
45 44
     public static void setUp() throws Exception {
46
-        IdentityManager.load();
45
+        IdentityManager.getIdentityManager().initialise();
47 46
         ActionManager.getActionManager().initialise();
48 47
     }
49 48
 

+ 3
- 2
test/com/dmdirc/actions/wrappers/AliasWrapperTest.java Прегледај датотеку

@@ -27,22 +27,23 @@ import com.dmdirc.actions.ActionCondition;
27 27
 import com.dmdirc.actions.CoreActionComparison;
28 28
 import com.dmdirc.actions.CoreActionComponent;
29 29
 import com.dmdirc.actions.CoreActionType;
30
-import com.dmdirc.interfaces.actions.ActionType;
31 30
 import com.dmdirc.config.IdentityManager;
32 31
 import com.dmdirc.config.InvalidIdentityFileException;
32
+import com.dmdirc.interfaces.actions.ActionType;
33 33
 
34 34
 import java.util.ArrayList;
35 35
 import java.util.List;
36 36
 
37 37
 import org.junit.BeforeClass;
38 38
 import org.junit.Test;
39
+
39 40
 import static org.junit.Assert.*;
40 41
 
41 42
 public class AliasWrapperTest {
42 43
 
43 44
     @BeforeClass
44 45
     public static void setupClass() throws InvalidIdentityFileException {
45
-        IdentityManager.load();
46
+        IdentityManager.getIdentityManager().initialise();
46 47
     }
47 48
 
48 49
     @Test

+ 4
- 3
test/com/dmdirc/commandparser/CommandArgumentsTest.java Прегледај датотеку

@@ -22,20 +22,21 @@
22 22
 
23 23
 package com.dmdirc.commandparser;
24 24
 
25
-import java.util.Arrays;
26
-
27 25
 import com.dmdirc.config.IdentityManager;
28 26
 import com.dmdirc.config.InvalidIdentityFileException;
29 27
 
28
+import java.util.Arrays;
29
+
30 30
 import org.junit.BeforeClass;
31 31
 import org.junit.Test;
32
+
32 33
 import static org.junit.Assert.*;
33 34
 
34 35
 public class CommandArgumentsTest {
35 36
 
36 37
     @BeforeClass
37 38
     public static void beforeClass() throws InvalidIdentityFileException {
38
-        IdentityManager.load();
39
+        IdentityManager.getIdentityManager().initialise();
39 40
     }
40 41
 
41 42
     /** Ensures the ctor which takes a collection builds the 'line' property. */

+ 4
- 2
test/com/dmdirc/commandparser/commands/HelpTest.java Прегледај датотеку

@@ -29,18 +29,20 @@ import com.dmdirc.config.InvalidIdentityFileException;
29 29
 
30 30
 import java.util.LinkedList;
31 31
 import java.util.List;
32
+
32 33
 import org.junit.BeforeClass;
33 34
 import org.junit.Test;
34 35
 import org.junit.runner.RunWith;
35 36
 import org.junit.runners.Parameterized;
36
-import static org.junit.Assert.*;
37
+
38
+import static org.junit.Assert.assertTrue;
37 39
 
38 40
 @RunWith(Parameterized.class)
39 41
 public class HelpTest {
40 42
 
41 43
     @BeforeClass
42 44
     public static void setUpClass() throws Exception {
43
-        IdentityManager.load();
45
+        IdentityManager.getIdentityManager().initialise();
44 46
     }
45 47
 
46 48
     private CommandInfo info;

+ 4
- 3
test/com/dmdirc/commandparser/commands/channel/BanTest.java Прегледај датотеку

@@ -22,24 +22,25 @@
22 22
 
23 23
 package com.dmdirc.commandparser.commands.channel;
24 24
 
25
-import com.dmdirc.parser.interfaces.ClientInfo;
26 25
 import com.dmdirc.Channel;
27 26
 import com.dmdirc.FrameContainer;
28
-import com.dmdirc.config.IdentityManager;
29 27
 import com.dmdirc.commandparser.CommandArguments;
30 28
 import com.dmdirc.commandparser.commands.context.ChannelCommandContext;
29
+import com.dmdirc.config.IdentityManager;
31 30
 import com.dmdirc.parser.interfaces.ChannelClientInfo;
32 31
 import com.dmdirc.parser.interfaces.ChannelInfo;
32
+import com.dmdirc.parser.interfaces.ClientInfo;
33 33
 
34 34
 import org.junit.BeforeClass;
35 35
 import org.junit.Test;
36
+
36 37
 import static org.mockito.Mockito.*;
37 38
 
38 39
 public class BanTest {
39 40
 
40 41
     @BeforeClass
41 42
     public static void setUpClass() throws Exception {
42
-        IdentityManager.load();
43
+        IdentityManager.getIdentityManager().initialise();
43 44
     }
44 45
 
45 46
     private final Ban command = new Ban();

+ 3
- 2
test/com/dmdirc/commandparser/commands/channel/KickReasonTest.java Прегледај датотеку

@@ -24,22 +24,23 @@ package com.dmdirc.commandparser.commands.channel;
24 24
 
25 25
 import com.dmdirc.Channel;
26 26
 import com.dmdirc.FrameContainer;
27
-import com.dmdirc.config.IdentityManager;
28 27
 import com.dmdirc.commandparser.CommandArguments;
29 28
 import com.dmdirc.commandparser.commands.context.ChannelCommandContext;
30 29
 import com.dmdirc.config.ConfigManager;
30
+import com.dmdirc.config.IdentityManager;
31 31
 import com.dmdirc.parser.irc.IRCChannelClientInfo;
32 32
 import com.dmdirc.parser.irc.IRCChannelInfo;
33 33
 
34 34
 import org.junit.BeforeClass;
35 35
 import org.junit.Test;
36
+
36 37
 import static org.mockito.Mockito.*;
37 38
 
38 39
 public class KickReasonTest {
39 40
 
40 41
     @BeforeClass
41 42
     public static void setUpClass() throws Exception {
42
-        IdentityManager.load();
43
+        IdentityManager.getIdentityManager().initialise();
43 44
     }
44 45
 
45 46
     private final KickReason command = new KickReason();

+ 1
- 6
test/com/dmdirc/commandparser/commands/channel/ModeTest.java Прегледај датотеку

@@ -33,8 +33,8 @@ import com.dmdirc.parser.irc.IRCChannelInfo;
33 33
 import com.dmdirc.parser.irc.IRCParser;
34 34
 
35 35
 import org.junit.Before;
36
-import org.junit.BeforeClass;
37 36
 import org.junit.Test;
37
+
38 38
 import static org.mockito.Mockito.*;
39 39
 
40 40
 public class ModeTest {
@@ -45,11 +45,6 @@ public class ModeTest {
45 45
     private Server server;
46 46
     private IRCParser parser;
47 47
 
48
-    @BeforeClass
49
-    public static void setUpClass() throws InvalidIdentityFileException {
50
-        IdentityManager.load();
51
-    }
52
-
53 48
     @Before
54 49
     public void setUp() throws InvalidIdentityFileException {
55 50
         IdentityManager.load();

+ 2
- 7
test/com/dmdirc/commandparser/commands/channel/NamesTest.java Прегледај датотеку

@@ -32,8 +32,8 @@ import com.dmdirc.parser.irc.IRCChannelInfo;
32 32
 import com.dmdirc.parser.irc.IRCParser;
33 33
 
34 34
 import org.junit.Before;
35
-import org.junit.BeforeClass;
36 35
 import org.junit.Test;
36
+
37 37
 import static org.mockito.Mockito.*;
38 38
 
39 39
 public class NamesTest {
@@ -44,14 +44,9 @@ public class NamesTest {
44 44
     private Server server;
45 45
     private IRCParser parser;
46 46
 
47
-    @BeforeClass
48
-    public static void setUpClass() throws InvalidIdentityFileException {
49
-        IdentityManager.load();
50
-    }
51
-
52 47
     @Before
53 48
     public void setUp() throws InvalidIdentityFileException {
54
-        IdentityManager.load();
49
+        IdentityManager.getIdentityManager().initialise();
55 50
 
56 51
         parser = mock(IRCParser.class);
57 52
         server = mock(Server.class);

+ 2
- 7
test/com/dmdirc/commandparser/commands/channel/PartTest.java Прегледај датотеку

@@ -31,8 +31,8 @@ import com.dmdirc.config.IdentityManager;
31 31
 import com.dmdirc.config.InvalidIdentityFileException;
32 32
 
33 33
 import org.junit.Before;
34
-import org.junit.BeforeClass;
35 34
 import org.junit.Test;
35
+
36 36
 import static org.mockito.Mockito.*;
37 37
 
38 38
 public class PartTest {
@@ -42,14 +42,9 @@ public class PartTest {
42 42
     private FrameContainer origin;
43 43
     private ConfigManager manager;
44 44
 
45
-    @BeforeClass
46
-    public static void setUpClass() throws InvalidIdentityFileException {
47
-        IdentityManager.load();
48
-    }
49
-
50 45
     @Before
51 46
     public void setUp() throws InvalidIdentityFileException {
52
-        IdentityManager.load();
47
+        IdentityManager.getIdentityManager().initialise();
53 48
 
54 49
         channel = mock(Channel.class);
55 50
         origin = mock(FrameContainer.class);

+ 4
- 2
test/com/dmdirc/commandparser/commands/channel/SetNickColourTest.java Прегледај датотеку

@@ -26,10 +26,12 @@ import com.dmdirc.FrameContainer;
26 26
 import com.dmdirc.commandparser.CommandArguments;
27 27
 import com.dmdirc.commandparser.commands.context.ChannelCommandContext;
28 28
 import com.dmdirc.config.IdentityManager;
29
-import org.junit.Before;
30 29
 
30
+import org.junit.Before;
31 31
 import org.junit.BeforeClass;
32 32
 import org.junit.Test;
33
+
34
+import static org.mockito.Matchers.*;
33 35
 import static org.mockito.Mockito.*;
34 36
 
35 37
 public class SetNickColourTest {
@@ -38,7 +40,7 @@ public class SetNickColourTest {
38 40
 
39 41
     @BeforeClass
40 42
     public static void setUpClass() throws Exception {
41
-        IdentityManager.load();
43
+        IdentityManager.getIdentityManager().initialise();
42 44
     }
43 45
 
44 46
     @Before

+ 4
- 2
test/com/dmdirc/commandparser/commands/chat/MeTest.java Прегледај датотеку

@@ -26,10 +26,12 @@ import com.dmdirc.MessageTarget;
26 26
 import com.dmdirc.commandparser.CommandArguments;
27 27
 import com.dmdirc.commandparser.commands.context.ChatCommandContext;
28 28
 import com.dmdirc.config.IdentityManager;
29
-import org.junit.Before;
30 29
 
30
+import org.junit.Before;
31 31
 import org.junit.BeforeClass;
32 32
 import org.junit.Test;
33
+
34
+import static org.mockito.Matchers.*;
33 35
 import static org.mockito.Mockito.*;
34 36
 
35 37
 public class MeTest {
@@ -39,7 +41,7 @@ public class MeTest {
39 41
 
40 42
     @BeforeClass
41 43
     public static void setUpClass() throws Exception {
42
-        IdentityManager.load();
44
+        IdentityManager.getIdentityManager().initialise();
43 45
     }
44 46
 
45 47
     @Before

+ 16
- 13
test/com/dmdirc/commandparser/commands/flags/CommandFlagHandlerTest.java Прегледај датотеку

@@ -21,23 +21,26 @@
21 21
  */
22 22
 package com.dmdirc.commandparser.commands.flags;
23 23
 
24
-import com.dmdirc.config.InvalidIdentityFileException;
25
-import java.util.Map;
26 24
 import com.dmdirc.FrameContainer;
27 25
 import com.dmdirc.commandparser.CommandArguments;
28 26
 import com.dmdirc.config.IdentityManager;
27
+import com.dmdirc.config.InvalidIdentityFileException;
28
+
29 29
 import java.util.Arrays;
30 30
 import java.util.List;
31
+import java.util.Map;
32
+
31 33
 import org.junit.BeforeClass;
32 34
 import org.junit.Test;
33 35
 import org.junit.runner.RunWith;
34 36
 import org.junit.runners.Parameterized;
37
+
35 38
 import static org.junit.Assert.*;
36
-import static org.mockito.Mockito.*;
39
+import static org.mockito.Mockito.mock;
37 40
 
38 41
 @RunWith(Parameterized.class)
39 42
 public class CommandFlagHandlerTest {
40
-    
43
+
41 44
     private static final CommandFlag noArgsFlag1 = new CommandFlag("noargs1");
42 45
     private static final CommandFlag noArgsFlag2 = new CommandFlag("noargs2", false);
43 46
     private static final CommandFlag noArgsFlag3 = new CommandFlag("noargs3");
@@ -47,35 +50,35 @@ public class CommandFlagHandlerTest {
47 50
     private static final CommandFlag defArgsFlag1 = new CommandFlag("defargs1", true, 0, 1);
48 51
     private static final CommandFlag defArgsFlag2 = new CommandFlag("defargs2", true, 0, 2);
49 52
     private final CommandFlagHandler handler;
50
-    
53
+
51 54
     private final String input;
52 55
     private final CommandFlag[] flags;
53 56
     private final int[] offsets;
54
-    
57
+
55 58
     @BeforeClass
56 59
     public static void setupClass() throws InvalidIdentityFileException {
57
-        IdentityManager.load();
60
+        IdentityManager.getIdentityManager().initialise();
58 61
     }
59
-    
62
+
60 63
     public CommandFlagHandlerTest(String input, CommandFlag[] flags, int[] offsets) {
61 64
         noArgsFlag3.addEnabled(noArgsFlag4);
62 65
         noArgsFlag3.addDisabled(noArgsFlag1);
63 66
 
64 67
         handler = new CommandFlagHandler(noArgsFlag1, noArgsFlag2, noArgsFlag3,
65 68
                 noArgsFlag4, immArgsFlag1, immArgsFlag2, defArgsFlag1, defArgsFlag2);
66
-        
69
+
67 70
         this.input = input;
68 71
         this.flags = flags;
69 72
         this.offsets = offsets;
70 73
     }
71
-    
74
+
72 75
     @Test
73 76
     public void testParse() {
74 77
         final FrameContainer container = mock(FrameContainer.class);
75
-        
78
+
76 79
         final Map<CommandFlag, Integer> results
77 80
                 = handler.parse(container, new CommandArguments(input));
78
-        
81
+
79 82
         if (flags == null) {
80 83
             assertNull("Command should fail: " + input, results);
81 84
         } else {
@@ -137,6 +140,6 @@ public class CommandFlagHandlerTest {
137 140
         };
138 141
 
139 142
         return Arrays.asList(tests);
140
-    }    
143
+    }
141 144
 
142 145
 }

+ 3
- 1
test/com/dmdirc/commandparser/commands/global/AliasCommandTest.java Прегледај датотеку

@@ -28,6 +28,8 @@ import com.dmdirc.config.IdentityManager;
28 28
 
29 29
 import org.junit.BeforeClass;
30 30
 import org.junit.Test;
31
+
32
+import static org.mockito.Matchers.*;
31 33
 import static org.mockito.Mockito.*;
32 34
 
33 35
 public class AliasCommandTest {
@@ -36,7 +38,7 @@ public class AliasCommandTest {
36 38
 
37 39
     @BeforeClass
38 40
     public static void setUpClass() throws Exception {
39
-        IdentityManager.load();
41
+        IdentityManager.getIdentityManager().initialise();
40 42
     }
41 43
 
42 44
     @Test

+ 2
- 1
test/com/dmdirc/commandparser/commands/global/IfpluginTest.java Прегледај датотеку

@@ -28,6 +28,7 @@ import com.dmdirc.config.IdentityManager;
28 28
 
29 29
 import org.junit.BeforeClass;
30 30
 import org.junit.Test;
31
+
31 32
 import static org.mockito.Mockito.*;
32 33
 
33 34
 public class IfpluginTest {
@@ -36,7 +37,7 @@ public class IfpluginTest {
36 37
 
37 38
     @BeforeClass
38 39
     public static void setUpClass() throws Exception {
39
-        IdentityManager.load();
40
+        IdentityManager.getIdentityManager().initialise();
40 41
     }
41 42
 
42 43
     @Test

+ 6
- 4
test/com/dmdirc/commandparser/commands/global/NewServerTest.java Прегледај датотеку

@@ -21,26 +21,28 @@
21 21
  */
22 22
 package com.dmdirc.commandparser.commands.global;
23 23
 
24
-import com.dmdirc.Server;
25
-import com.dmdirc.config.Identity;
26
-import java.net.URI;
27 24
 import com.dmdirc.FrameContainer;
25
+import com.dmdirc.Server;
28 26
 import com.dmdirc.commandparser.CommandArguments;
29 27
 import com.dmdirc.commandparser.commands.context.CommandContext;
28
+import com.dmdirc.config.Identity;
30 29
 import com.dmdirc.config.IdentityManager;
31 30
 import com.dmdirc.interfaces.ServerFactory;
31
+
32
+import java.net.URI;
32 33
 import java.net.URISyntaxException;
33 34
 
34 35
 import org.junit.Before;
35 36
 import org.junit.BeforeClass;
36 37
 import org.junit.Test;
38
+
37 39
 import static org.mockito.Mockito.*;
38 40
 
39 41
 public class NewServerTest {
40 42
 
41 43
     @BeforeClass
42 44
     public static void setUpClass() throws Exception {
43
-        IdentityManager.load();
45
+        IdentityManager.getIdentityManager().initialise();
44 46
     }
45 47
 
46 48
     private FrameContainer container;

+ 3
- 1
test/com/dmdirc/commandparser/commands/server/ChangeServerTest.java Прегледај датотеку

@@ -30,9 +30,11 @@ import com.dmdirc.config.IdentityManager;
30 30
 
31 31
 import java.net.URI;
32 32
 import java.net.URISyntaxException;
33
+
33 34
 import org.junit.Before;
34 35
 import org.junit.BeforeClass;
35 36
 import org.junit.Test;
37
+
36 38
 import static org.mockito.Mockito.*;
37 39
 
38 40
 public class ChangeServerTest {
@@ -44,7 +46,7 @@ public class ChangeServerTest {
44 46
 
45 47
     @BeforeClass
46 48
     public static void setUpClass() throws Exception {
47
-        IdentityManager.load();
49
+        IdentityManager.getIdentityManager().initialise();
48 50
     }
49 51
 
50 52
     @Before

+ 8
- 6
test/com/dmdirc/commandparser/parsers/GlobalCommandParserTest.java Прегледај датотеку

@@ -23,24 +23,26 @@
23 23
 package com.dmdirc.commandparser.parsers;
24 24
 
25 25
 import com.dmdirc.config.IdentityManager;
26
+
26 27
 import org.junit.BeforeClass;
27 28
 import org.junit.Test;
28
-import static org.junit.Assert.*;
29
+
30
+import static org.junit.Assert.assertSame;
29 31
 
30 32
 public class GlobalCommandParserTest {
31
-    
33
+
32 34
     @BeforeClass
33 35
     public static void setUp() throws Exception {
34
-        IdentityManager.load();
36
+        IdentityManager.getIdentityManager().initialise();
35 37
     }
36 38
 
37 39
     @Test
38 40
     public void testGetGlobalCommandParser() {
39 41
         final GlobalCommandParser p1 = GlobalCommandParser.getGlobalCommandParser();
40
-        
42
+
41 43
         final GlobalCommandParser p2 = GlobalCommandParser.getGlobalCommandParser();
42
-        
44
+
43 45
         assertSame(p1, p2);
44 46
     }
45
-    
47
+
46 48
 }

+ 9
- 7
test/com/dmdirc/config/CipherUtilsTest.java Прегледај датотеку

@@ -23,29 +23,31 @@
23 23
 package com.dmdirc.config;
24 24
 
25 25
 import com.dmdirc.harness.TestCipherUtils;
26
+
26 27
 import org.junit.Before;
27 28
 import org.junit.Test;
29
+
28 30
 import static org.junit.Assert.*;
29 31
 
30 32
 public class CipherUtilsTest {
31
-    
33
+
32 34
     @Before
33 35
     public void setUp() throws Exception {
34
-        IdentityManager.load();
35
-    }    
36
+        IdentityManager.getIdentityManager().initialise();
37
+    }
36 38
 
37 39
     @Test
38 40
     public void testEncryptDecrypt() {
39 41
         final String source = "DMDirc unit test {}!";
40 42
         final CipherUtils utils = new TestCipherUtils();
41
-        
43
+
42 44
         final String encrypted = utils.encrypt(source);
43 45
         assertNotNull(encrypted);
44
-        
46
+
45 47
         final String decrypted = utils.decrypt(encrypted);
46 48
         assertNotNull(decrypted);
47
-        
49
+
48 50
         assertEquals(source, decrypted);
49 51
     }
50
-    
52
+
51 53
 }

+ 5
- 8
test/com/dmdirc/config/prefs/PreferencesManagerTest.java Прегледај датотеку

@@ -21,30 +21,27 @@
21 21
  */
22 22
 package com.dmdirc.config.prefs;
23 23
 
24
-import com.dmdirc.config.ConfigManager;
25 24
 import com.dmdirc.Main;
26 25
 import com.dmdirc.actions.ActionManager;
27 26
 import com.dmdirc.actions.CoreActionType;
27
+import com.dmdirc.config.ConfigManager;
28 28
 import com.dmdirc.config.IdentityManager;
29 29
 import com.dmdirc.interfaces.ActionListener;
30
-
31 30
 import com.dmdirc.plugins.PluginManager;
32
-import com.dmdirc.interfaces.ui.UIController;
31
+
33 32
 import org.junit.BeforeClass;
34 33
 import org.junit.Test;
34
+
35 35
 import static org.junit.Assert.*;
36 36
 import static org.mockito.Mockito.*;
37 37
 
38 38
 public class PreferencesManagerTest {
39 39
 
40
-    private static UIController controller;
41
-
42 40
     @BeforeClass
43 41
     public static void setUp() throws Exception {
44
-        IdentityManager.load();
42
+        IdentityManager.getIdentityManager().initialise();
45 43
         Main.extractCorePlugins("ui_");
46 44
         PluginManager.getPluginManager();
47
-        controller = mock(UIController.class);
48 45
     }
49 46
 
50 47
     @Test
@@ -106,7 +103,7 @@ public class PreferencesManagerTest {
106 103
     public void testGetCategory() {
107 104
         ConfigManager cm = mock(ConfigManager.class);
108 105
         when(cm.getOption("domain", "option")).thenReturn("fallback");
109
-        
106
+
110 107
         final PreferencesDialogModel pm = new PreferencesDialogModel(null, null, null, null, cm, null);
111 108
         assertNull(pm.getCategory("unittest123"));
112 109
     }

+ 1
- 1
test/com/dmdirc/config/prefs/PreferencesSettingTest.java Прегледај датотеку

@@ -40,7 +40,7 @@ public class PreferencesSettingTest {
40 40
 
41 41
     @BeforeClass
42 42
     public static void setUp() throws Exception {
43
-        IdentityManager.load();
43
+        IdentityManager.getIdentityManager().initialise();
44 44
     }
45 45
 
46 46
     @Test(expected=IllegalArgumentException.class)

+ 7
- 7
test/com/dmdirc/config/validators/URLProtocolValidatorTest.java Прегледај датотеку

@@ -1,16 +1,16 @@
1 1
 /*
2 2
  * Copyright (c) 2006-2011 DMDirc Developers
3
- * 
3
+ *
4 4
  * Permission is hereby granted, free of charge, to any person obtaining a copy
5 5
  * of this software and associated documentation files (the "Software"), to deal
6 6
  * in the Software without restriction, including without limitation the rights
7 7
  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 8
  * copies of the Software, and to permit persons to whom the Software is
9 9
  * furnished to do so, subject to the following conditions:
10
- * 
10
+ *
11 11
  * The above copyright notice and this permission notice shall be included in
12 12
  * all copies or substantial portions of the Software.
13
- * 
13
+ *
14 14
  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 15
  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 16
  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
@@ -28,18 +28,18 @@ import org.junit.Test;
28 28
 import static org.junit.Assert.*;
29 29
 
30 30
 public class URLProtocolValidatorTest {
31
-    
31
+
32 32
     @Test
33 33
     public void testValidate() throws InvalidIdentityFileException {
34
-        IdentityManager.load();
34
+        IdentityManager.getIdentityManager().initialise();
35 35
         IdentityManager.getConfigIdentity().setOption("protocol", "unit-test-1", "BROWSER");
36
-        
36
+
37 37
         final URLProtocolValidator validator = new URLProtocolValidator();
38 38
         assertTrue(validator.validate(null).isFailure());
39 39
         assertTrue(validator.validate("").isFailure());
40 40
         assertTrue(validator.validate("unit-test-1").isFailure());
41 41
         assertFalse(validator.validate("unit-test-2").isFailure());
42
-        
42
+
43 43
         IdentityManager.getConfigIdentity().unsetOption("protocol", "unit-test-1");
44 44
     }
45 45
 

+ 7
- 5
test/com/dmdirc/logger/DMDircExceptionHandlerTest.java Прегледај датотеку

@@ -22,25 +22,27 @@
22 22
 package com.dmdirc.logger;
23 23
 
24 24
 import com.dmdirc.config.IdentityManager;
25
+
25 26
 import org.junit.BeforeClass;
26 27
 import org.junit.Test;
27
-import static org.junit.Assert.*;
28
+
29
+import static org.junit.Assert.assertEquals;
28 30
 
29 31
 public class DMDircExceptionHandlerTest {
30 32
 
31 33
     @BeforeClass
32 34
     public static void setUpClass() throws Exception {
33
-        IdentityManager.load();
35
+        IdentityManager.getIdentityManager().initialise();
34 36
     }
35 37
 
36 38
     @Test
37 39
     public void testUncaughtException() {
38 40
         final DMDircExceptionHandler eh = new DMDircExceptionHandler();
39
-        
41
+
40 42
         final int initial = ErrorManager.getErrorManager().getErrorCount();
41
-        
43
+
42 44
         eh.uncaughtException(null, new Exception());
43
-        
45
+
44 46
         assertEquals(initial + 1, ErrorManager.getErrorManager().getErrorCount());
45 47
     }
46 48
 

+ 12
- 9
test/com/dmdirc/logger/ProgramErrorTest.java Прегледај датотеку

@@ -23,17 +23,20 @@ package com.dmdirc.logger;
23 23
 
24 24
 import com.dmdirc.config.IdentityManager;
25 25
 import com.dmdirc.config.InvalidIdentityFileException;
26
+
26 27
 import java.util.Arrays;
27 28
 import java.util.Date;
29
+
28 30
 import org.junit.BeforeClass;
29 31
 import org.junit.Test;
32
+
30 33
 import static org.junit.Assert.*;
31 34
 
32 35
 public class ProgramErrorTest {
33
-    
36
+
34 37
     @BeforeClass
35 38
     public static void setup() throws InvalidIdentityFileException {
36
-        IdentityManager.load();
39
+        IdentityManager.getIdentityManager().initialise();
37 40
     }
38 41
 
39 42
     @Test
@@ -169,7 +172,7 @@ public class ProgramErrorTest {
169 172
         pe.setReportStatus(ErrorReportStatus.ERROR);
170 173
         assertEquals(ErrorReportStatus.ERROR, pe.getReportStatus());
171 174
     }
172
-    
175
+
173 176
     @Test
174 177
     public void testFixedStatus() {
175 178
         final ProgramError pe = new ProgramError(1, ErrorLevel.HIGH, "moo",
@@ -182,14 +185,14 @@ public class ProgramErrorTest {
182 185
         pe.setFixedStatus(ErrorFixedStatus.INVALID);
183 186
         assertEquals(ErrorFixedStatus.INVALID, pe.getFixedStatus());
184 187
     }
185
-    
188
+
186 189
     @Test
187 190
     public void testToString() {
188 191
         final ProgramError pe = new ProgramError(1, ErrorLevel.HIGH, "moo",
189 192
                 new String[0], new Date());
190 193
         assertTrue(pe.toString().indexOf("moo") > -1);
191 194
     }
192
-    
195
+
193 196
     @Test
194 197
     public void testEquals() {
195 198
         final ProgramError pe1 = new ProgramError(10, ErrorLevel.LOW, "moo",
@@ -202,20 +205,20 @@ public class ProgramErrorTest {
202 205
                 new String[0], new Date());
203 206
         final ProgramError pe5 = new ProgramError(10, ErrorLevel.LOW, "moo",
204 207
                 new String[]{"Hello"}, new Date());
205
-        
208
+
206 209
         assertFalse(pe1.equals(null));
207 210
         assertFalse(pe1.equals("moo"));
208
-        
211
+
209 212
         assertTrue(pe1.equals(pe2));
210 213
         assertTrue(pe1.equals(pe1));
211 214
         assertTrue(pe2.equals(pe1));
212
-        
215
+
213 216
         assertFalse(pe1.equals(pe3));
214 217
         assertFalse(pe1.equals(pe4));
215 218
         assertFalse(pe1.equals(pe5));
216 219
         assertFalse(pe4.equals(pe5));
217 220
         assertFalse(pe4.equals(pe3));
218
-        
221
+
219 222
         assertEquals(pe1.hashCode(), pe2.hashCode());
220 223
         assertEquals(pe1.hashCode(), pe1.hashCode());
221 224
     }

+ 3
- 2
test/com/dmdirc/ui/WindowManagerTest.java Прегледај датотеку

@@ -22,22 +22,23 @@
22 22
 package com.dmdirc.ui;
23 23
 
24 24
 import com.dmdirc.FrameContainer;
25
-import com.dmdirc.harness.TestWritableFrameContainer;
26 25
 import com.dmdirc.addons.ui_dummy.DummyInputWindow;
27 26
 import com.dmdirc.config.IdentityManager;
28 27
 import com.dmdirc.config.InvalidIdentityFileException;
28
+import com.dmdirc.harness.TestWritableFrameContainer;
29 29
 import com.dmdirc.interfaces.ui.FrameListener;
30 30
 import com.dmdirc.interfaces.ui.Window;
31 31
 
32 32
 import org.junit.BeforeClass;
33 33
 import org.junit.Test;
34
+
34 35
 import static org.mockito.Mockito.*;
35 36
 
36 37
 public class WindowManagerTest {
37 38
 
38 39
     @BeforeClass
39 40
     public static void setupClass() throws InvalidIdentityFileException {
40
-        IdentityManager.load();
41
+        IdentityManager.getIdentityManager().initialise();
41 42
     }
42 43
 
43 44
     @Test

+ 3
- 2
test/com/dmdirc/ui/messages/ColourManagerTest.java Прегледај датотеку

@@ -22,18 +22,19 @@
22 22
 
23 23
 package com.dmdirc.ui.messages;
24 24
 
25
-import com.dmdirc.ui.Colour;
26 25
 import com.dmdirc.config.IdentityManager;
26
+import com.dmdirc.ui.Colour;
27 27
 
28 28
 import org.junit.BeforeClass;
29 29
 import org.junit.Test;
30
+
30 31
 import static org.junit.Assert.*;
31 32
 
32 33
 public class ColourManagerTest {
33 34
 
34 35
     @BeforeClass
35 36
     public static void setUp() throws Exception {
36
-        IdentityManager.load();
37
+        IdentityManager.getIdentityManager().initialise();
37 38
     }
38 39
 
39 40
     @Test

+ 11
- 8
test/com/dmdirc/ui/messages/IntelligentLinkingTest.java Прегледај датотеку

@@ -26,21 +26,24 @@ import com.dmdirc.Server;
26 26
 import com.dmdirc.config.ConfigManager;
27 27
 import com.dmdirc.config.IdentityManager;
28 28
 import com.dmdirc.config.InvalidIdentityFileException;
29
+
29 30
 import java.util.Arrays;
30 31
 import java.util.List;
32
+
31 33
 import org.junit.BeforeClass;
32 34
 import org.junit.Test;
33 35
 import org.junit.runner.RunWith;
34 36
 import org.junit.runners.Parameterized;
37
+
35 38
 import static org.junit.Assert.*;
36 39
 import static org.mockito.Mockito.*;
37 40
 
38 41
 @RunWith(Parameterized.class)
39 42
 public class IntelligentLinkingTest {
40
-    
43
+
41 44
     private final String input, expected;
42 45
     private final Styliser styliser;
43
-    
46
+
44 47
     public IntelligentLinkingTest(String input, String expected) {
45 48
         this.input = input;
46 49
         this.expected = expected;
@@ -51,15 +54,15 @@ public class IntelligentLinkingTest {
51 54
         when(server.getChannelPrefixes()).thenReturn("#&+");
52 55
         when(container.getServer()).thenReturn(server);
53 56
         when(container.getConfigManager()).thenReturn(manager);
54
-        
57
+
55 58
         styliser = new Styliser(container);
56 59
     }
57
-    
60
+
58 61
     @BeforeClass
59 62
     public static void setUp() throws InvalidIdentityFileException {
60
-        IdentityManager.load();
61
-    }    
62
-    
63
+        IdentityManager.getIdentityManager().initialise();
64
+    }
65
+
63 66
     @Test
64 67
     public void testLink() throws InterruptedException {
65 68
         assertEquals(expected, styliser.doLinks(input)
@@ -117,6 +120,6 @@ public class IntelligentLinkingTest {
117 120
         };
118 121
 
119 122
         return Arrays.asList(tests);
120
-    }    
123
+    }
121 124
 
122 125
 }

+ 24
- 20
test/com/dmdirc/ui/messages/StyliserStylesTest.java Прегледај датотеку

@@ -27,17 +27,21 @@ import com.dmdirc.config.ConfigManager;
27 27
 import com.dmdirc.config.IdentityManager;
28 28
 import com.dmdirc.config.InvalidIdentityFileException;
29 29
 import com.dmdirc.ui.core.util.Utils;
30
+
30 31
 import java.awt.Color;
31 32
 import java.awt.font.TextAttribute;
32 33
 import java.text.AttributedCharacterIterator;
33 34
 import java.util.Arrays;
34 35
 import java.util.List;
35 36
 import java.util.Map;
37
+
36 38
 import javax.swing.text.DefaultStyledDocument;
39
+
37 40
 import org.junit.BeforeClass;
38 41
 import org.junit.Test;
39 42
 import org.junit.runner.RunWith;
40 43
 import org.junit.runners.Parameterized;
44
+
41 45
 import static org.junit.Assert.*;
42 46
 import static org.mockito.Mockito.*;
43 47
 
@@ -53,14 +57,14 @@ public class StyliserStylesTest {
53 57
 
54 58
     @BeforeClass
55 59
     public static void setUp() throws InvalidIdentityFileException {
56
-        IdentityManager.load();
60
+        IdentityManager.getIdentityManager().initialise();
57 61
     }
58
-        
62
+
59 63
     @Test
60 64
     public void testStyle() {
61 65
         assertEquals(output, style(input));
62 66
     }
63
-    
67
+
64 68
     protected static String style(final String input) {
65 69
         final DefaultStyledDocument doc = new DefaultStyledDocument();
66 70
         final StringBuilder builder = new StringBuilder();
@@ -74,36 +78,36 @@ public class StyliserStylesTest {
74 78
         final AttributedCharacterIterator aci = Utils.getAttributedString(styliser,
75 79
                 new String[]{input, }, "dialog", 12).
76 80
                 getAttributedString().getIterator();
77
-         
81
+
78 82
         Map<AttributedCharacterIterator.Attribute, Object> map = null;
79 83
         char chr = aci.current();
80
-        
84
+
81 85
         while (aci.getIndex() < aci.getEndIndex()) {
82
-            if (!aci.getAttributes().equals(map)) {                
86
+            if (!aci.getAttributes().equals(map)) {
83 87
                 style(aci.getAttributes(), builder);
84 88
                 map = aci.getAttributes();
85 89
             }
86
-            
90
+
87 91
             builder.append(chr);
88 92
             chr = aci.next();
89 93
         }
90
-        
94
+
91 95
         return builder.toString();
92 96
     }
93
-    
97
+
94 98
     protected static void style(final Map<AttributedCharacterIterator.Attribute, Object> map,
95
-            final StringBuilder builder) {                    
99
+            final StringBuilder builder) {
96 100
         builder.append('<');
97
-        
101
+
98 102
         String[] entries = new String[9];
99
-        
103
+
100 104
         for (Map.Entry<AttributedCharacterIterator.Attribute, Object> entry : map.entrySet()) {
101
-        
105
+
102 106
             if (entry.getKey().equals(TextAttribute.FOREGROUND)) {
103 107
                 entries[0] = "color=" + toColour(entry.getValue());
104 108
             } else if (entry.getKey().equals(TextAttribute.BACKGROUND)) {
105 109
                 entries[1] = "background=" + toColour(entry.getValue());
106
-            } else if (entry.getKey().equals(TextAttribute.WEIGHT)) { 
110
+            } else if (entry.getKey().equals(TextAttribute.WEIGHT)) {
107 111
                 entries[2] = "bold";
108 112
             } else if (entry.getKey().equals(TextAttribute.FAMILY)
109 113
                     && entry.getValue().equals("monospaced")) {
@@ -120,7 +124,7 @@ public class StyliserStylesTest {
120 124
                 entries[8] = "nickname";
121 125
             }
122 126
         }
123
-        
127
+
124 128
         int count = 0;
125 129
         for (String entry : entries) {
126 130
             if (entry != null) {
@@ -129,20 +133,20 @@ public class StyliserStylesTest {
129 133
                 count++;
130 134
             }
131 135
         }
132
-        
136
+
133 137
         if (count > 0) {
134 138
             builder.deleteCharAt(builder.length() - 1);
135 139
         }
136 140
         builder.append('>');
137 141
     }
138
-    
142
+
139 143
     protected static String toColour(final Object object) {
140 144
         final Color colour = (Color) object;
141
-        
145
+
142 146
         return colour.getRed() + "," + colour.getGreen() + ","
143 147
                 + colour.getBlue();
144 148
     }
145
-    
149
+
146 150
     @Parameterized.Parameters
147 151
     public static List<String[]> data() {
148 152
         final String[][] tests = {
@@ -197,6 +201,6 @@ public class StyliserStylesTest {
197 201
         };
198 202
 
199 203
         return Arrays.asList(tests);
200
-    } 
204
+    }
201 205
 
202 206
 }

+ 4
- 1
test/com/dmdirc/ui/messages/StyliserTest.java Прегледај датотеку

@@ -26,9 +26,12 @@ import com.dmdirc.FrameContainer;
26 26
 import com.dmdirc.config.ConfigManager;
27 27
 import com.dmdirc.config.IdentityManager;
28 28
 import com.dmdirc.config.InvalidIdentityFileException;
29
+
29 30
 import java.util.Enumeration;
31
+
30 32
 import org.junit.Before;
31 33
 import org.junit.Test;
34
+
32 35
 import static org.junit.Assert.*;
33 36
 import static org.mockito.Mockito.*;
34 37
 
@@ -36,7 +39,7 @@ public class StyliserTest {
36 39
 
37 40
     @Before
38 41
     public void setUp() throws InvalidIdentityFileException {
39
-        IdentityManager.load();
42
+        IdentityManager.getIdentityManager().initialise();
40 43
     }
41 44
 
42 45
     @Test

+ 6
- 4
test/com/dmdirc/updater/UpdateTest.java Прегледај датотеку

@@ -24,20 +24,22 @@ package com.dmdirc.updater;
24 24
 
25 25
 import com.dmdirc.config.IdentityManager;
26 26
 import com.dmdirc.updater.components.ClientComponent;
27
+
27 28
 import org.junit.Before;
28 29
 import org.junit.BeforeClass;
29 30
 import org.junit.Test;
31
+
30 32
 import static org.junit.Assert.*;
31 33
 
32 34
 public class UpdateTest {
33 35
 
34 36
     @BeforeClass
35 37
     public static void setUpClass() throws Exception {
36
-        IdentityManager.load();
38
+        IdentityManager.getIdentityManager().initialise();
37 39
     }
38
-    
40
+
39 41
     private static final String SUBJECT = "outofdate client channel date version url";
40
-    
42
+
41 43
     private Update update;
42 44
 
43 45
     @Before
@@ -60,5 +62,5 @@ public class UpdateTest {
60 62
     public void testGetUrl() {
61 63
         assertEquals("url", update.getUrl());
62 64
     }
63
-    
65
+
64 66
 }

Loading…
Откажи
Сачувај