ソースを参照

Tests are now compatible with older JUnit style

git-svn-id: http://svn.dmdirc.com/trunk@1845 00569f92-eb28-0410-84fd-f71c24880f
tags/0.5
Chris Smith 17年前
コミット
065ab57e1b

+ 7
- 6
test/com/dmdirc/ServerManagerTest.java ファイルの表示

@@ -8,6 +8,7 @@
8 8
 package com.dmdirc;
9 9
 
10 10
 import com.dmdirc.config.IdentityManager;
11
+import junit.framework.TestCase;
11 12
 import org.junit.AfterClass;
12 13
 import org.junit.Before;
13 14
 import org.junit.BeforeClass;
@@ -18,7 +19,7 @@ import static org.junit.Assert.*;
18 19
  *
19 20
  * @author chris
20 21
  */
21
-public class ServerManagerTest {
22
+public class ServerManagerTest extends TestCase {
22 23
     
23 24
     public ServerManagerTest() {
24 25
         IdentityManager.load();
@@ -38,7 +39,7 @@ public class ServerManagerTest {
38 39
     }
39 40
     
40 41
     @Test
41
-    public void getServerManager() {
42
+    public void testGetServerManager() {
42 43
         final ServerManager resultA = ServerManager.getServerManager();
43 44
         final ServerManager resultB = ServerManager.getServerManager();
44 45
         
@@ -48,7 +49,7 @@ public class ServerManagerTest {
48 49
     }
49 50
     
50 51
     @Test
51
-    public void registerServer() {
52
+    public void testRegisterServer() {
52 53
         final Server server = new Server("127.0.0.1", 6667, "", false, IdentityManager.getProfiles().get(0));
53 54
         
54 55
         final ServerManager instance = ServerManager.getServerManager();
@@ -59,7 +60,7 @@ public class ServerManagerTest {
59 60
     }
60 61
     
61 62
     @Test
62
-    public void unregisterServer() {
63
+    public void testUnregisterServer() {
63 64
         final Server server = new Server("127.0.0.1", 6667, "", false, IdentityManager.getProfiles().get(0));
64 65
         
65 66
         server.close();
@@ -70,7 +71,7 @@ public class ServerManagerTest {
70 71
     }
71 72
     
72 73
     @Test
73
-    public void numServers() {
74
+    public void testNumServers() {
74 75
         final ServerManager instance = ServerManager.getServerManager();
75 76
         
76 77
         assertEquals(instance.getServers().size(), instance.numServers());
@@ -85,7 +86,7 @@ public class ServerManagerTest {
85 86
     }
86 87
     
87 88
     @Test
88
-    public void getServerFromFrame() {
89
+    public void testGetServerFromFrame() {
89 90
         final Server serverA = new Server("127.0.0.1", 6667, "", false, IdentityManager.getProfiles().get(0));
90 91
         final Server serverB = new Server("127.0.0.2", 6667, "", false, IdentityManager.getProfiles().get(0));
91 92
         

+ 3
- 2
test/com/dmdirc/StringTranscoderTest.java ファイルの表示

@@ -8,6 +8,7 @@
8 8
 package com.dmdirc;
9 9
 
10 10
 import java.nio.charset.Charset;
11
+import junit.framework.TestCase;
11 12
 import org.junit.After;
12 13
 import org.junit.AfterClass;
13 14
 import org.junit.Before;
@@ -19,7 +20,7 @@ import static org.junit.Assert.*;
19 20
  *
20 21
  * @author Chris
21 22
  */
22
-public class StringTranscoderTest {
23
+public class StringTranscoderTest extends TestCase {
23 24
     
24 25
     public StringTranscoderTest() {
25 26
     }
@@ -41,7 +42,7 @@ public class StringTranscoderTest {
41 42
     }
42 43
 
43 44
     @Test
44
-    public void transcode() {
45
+    public void testTranscode() {
45 46
         String string = new String(new byte[]{(byte) 0xCA, (byte) 0xAE});
46 47
         
47 48
         StringTranscoder instance = new StringTranscoder(Charset.forName("UTF-8"));

+ 11
- 9
test/com/dmdirc/actions/ActionManagerTest.java ファイルの表示

@@ -9,6 +9,7 @@ package com.dmdirc.actions;
9 9
 
10 10
 import com.dmdirc.Config;
11 11
 import com.dmdirc.config.IdentityManager;
12
+import junit.framework.TestCase;
12 13
 import org.junit.AfterClass;
13 14
 import org.junit.Before;
14 15
 import org.junit.BeforeClass;
@@ -19,28 +20,29 @@ import static org.junit.Assert.*;
19 20
  *
20 21
  * @author chris
21 22
  */
22
-public class ActionManagerTest {
23
+public class ActionManagerTest extends TestCase {
23 24
     
24 25
     public ActionManagerTest() {
25
-    }
26
-
27
-    @BeforeClass
28
-    public static void setUpClass() throws Exception {
29 26
         IdentityManager.load();
30 27
         ActionManager.init();
31 28
         Config.init();
32 29
     }
33
-
30
+    
31
+    @BeforeClass
32
+    public static void setUpClass() throws Exception {
33
+        
34
+    }
35
+    
34 36
     @AfterClass
35 37
     public static void tearDownClass() throws Exception {
36 38
     }
37
-
39
+    
38 40
     @Before
39 41
     public void setUp() throws Exception {
40 42
     }
41
-
43
+    
42 44
     @Test
43
-    public void substituteVars() {
45
+    public void testSubstituteVars() {
44 46
         final Object[] args = new Object[]{
45 47
             "foo", "someCommand", new String[]{"a", "b", "c", "d"}
46 48
         };

+ 4
- 3
test/com/dmdirc/actions/CoreActionMetaTypeTest.java ファイルの表示

@@ -7,6 +7,7 @@
7 7
 
8 8
 package com.dmdirc.actions;
9 9
 
10
+import junit.framework.TestCase;
10 11
 import org.junit.AfterClass;
11 12
 import org.junit.Before;
12 13
 import org.junit.BeforeClass;
@@ -17,7 +18,7 @@ import static org.junit.Assert.*;
17 18
  *
18 19
  * @author chris
19 20
  */
20
-public class CoreActionMetaTypeTest {
21
+public class CoreActionMetaTypeTest extends TestCase {
21 22
     
22 23
     public CoreActionMetaTypeTest() {
23 24
     }
@@ -35,14 +36,14 @@ public class CoreActionMetaTypeTest {
35 36
     }
36 37
 
37 38
     @Test
38
-    public void checkArgTypeSize() {
39
+    public void testCheckArgTypeSize() {
39 40
         for (CoreActionMetaType type : CoreActionMetaType.values()) {
40 41
             assertEquals(type.getArity(), type.getArgTypes().length);
41 42
         }
42 43
     }
43 44
     
44 45
     @Test
45
-    public void checkArgNameSize() {
46
+    public void testCheckArgNameSize() {
46 47
         for (CoreActionMetaType type : CoreActionMetaType.values()) {
47 48
             assertEquals(type.getArity(), type.getArgNames().length);
48 49
         }

+ 3
- 2
test/com/dmdirc/commandparser/GlobalCommandParserTest.java ファイルの表示

@@ -9,6 +9,7 @@ package com.dmdirc.commandparser;
9 9
 
10 10
 import com.dmdirc.Config;
11 11
 import com.dmdirc.config.IdentityManager;
12
+import junit.framework.TestCase;
12 13
 import org.junit.AfterClass;
13 14
 import org.junit.Before;
14 15
 import org.junit.BeforeClass;
@@ -19,7 +20,7 @@ import static org.junit.Assert.*;
19 20
  *
20 21
  * @author chris
21 22
  */
22
-public class GlobalCommandParserTest {
23
+public class GlobalCommandParserTest extends TestCase {
23 24
     
24 25
     public GlobalCommandParserTest() {
25 26
     }
@@ -39,7 +40,7 @@ public class GlobalCommandParserTest {
39 40
     }
40 41
 
41 42
     @Test
42
-    public void getGlobalCommandParser() {
43
+    public void testGetGlobalCommandParser() {
43 44
         final GlobalCommandParser p1 = GlobalCommandParser.getGlobalCommandParser();
44 45
         
45 46
         final GlobalCommandParser p2 = GlobalCommandParser.getGlobalCommandParser();

+ 3
- 2
test/com/dmdirc/parser/IRCParserTest.java ファイルの表示

@@ -8,6 +8,7 @@ package com.dmdirc.parser;
8 8
 
9 9
 import com.dmdirc.parser.callbacks.CallbackNotFound;
10 10
 import com.dmdirc.parser.callbacks.interfaces.IAwayState;
11
+import junit.framework.TestCase;
11 12
 import org.junit.Test;
12 13
 import static org.junit.Assert.*;
13 14
 
@@ -15,13 +16,13 @@ import static org.junit.Assert.*;
15 16
  *
16 17
  * @author Chris
17 18
  */
18
-public class IRCParserTest {
19
+public class IRCParserTest extends TestCase {
19 20
     
20 21
     public IRCParserTest() {
21 22
     }
22 23
     
23 24
     @Test
24
-    public void Issue042test() {
25
+    public void testIssue042() {
25 26
         boolean res = false;
26 27
         
27 28
         try {

+ 11
- 9
test/com/dmdirc/ui/messages/FormatterTest.java ファイルの表示

@@ -12,6 +12,7 @@ import com.dmdirc.Main;
12 12
 import com.dmdirc.config.IdentityManager;
13 13
 import java.io.File;
14 14
 import java.util.Set;
15
+import junit.framework.TestCase;
15 16
 import org.junit.AfterClass;
16 17
 import org.junit.Before;
17 18
 import org.junit.BeforeClass;
@@ -22,15 +23,16 @@ import static org.junit.Assert.*;
22 23
  *
23 24
  * @author chris
24 25
  */
25
-public class FormatterTest {
26
+public class FormatterTest extends TestCase {
26 27
     
27 28
     public FormatterTest() {
29
+        IdentityManager.load();
30
+        Config.init();
28 31
     }
29 32
 
30 33
     @BeforeClass
31 34
     public static void setUpClass() throws Exception {
32
-        IdentityManager.load();
33
-        Config.init();
35
+
34 36
     }
35 37
 
36 38
     @AfterClass
@@ -42,7 +44,7 @@ public class FormatterTest {
42 44
     }
43 45
 
44 46
     @Test
45
-    public void formatMessage() {
47
+    public void testFormatMessage() {
46 48
         Formatter.registerDefault("unitTest", "abc %2$s %1$s def");
47 49
         
48 50
         // Standard format test
@@ -58,7 +60,7 @@ public class FormatterTest {
58 60
     }
59 61
 
60 62
     @Test
61
-    public void getFormats() {
63
+    public void testGetFormats() {
62 64
         final Set<String> s1 = Formatter.getFormats();
63 65
         Formatter.registerDefault("unitTest3", "abc");
64 66
         final Set<String> s2 = Formatter.getFormats();
@@ -69,7 +71,7 @@ public class FormatterTest {
69 71
     }
70 72
 
71 73
     @Test
72
-    public void hasFormat() {
74
+    public void testHasFormat() {
73 75
         final String[] targets = new String[]{"unknown", "abc", "def", "unittestfail"};
74 76
         
75 77
         for (String target : targets) {
@@ -82,11 +84,11 @@ public class FormatterTest {
82 84
     }
83 85
 
84 86
     @Test
85
-    public void registerDefault() {
87
+    public void testRegisterDefault() {
86 88
     }
87 89
 
88 90
     @Test
89
-    public void saveAndLoad() {
91
+    public void testSaveAndLoad() {
90 92
         Formatter.registerDefault("unitTest_saveLoad", "");
91 93
         
92 94
         final String fileName = "unittest_formatter";
@@ -110,7 +112,7 @@ public class FormatterTest {
110 112
     }
111 113
 
112 114
     @Test
113
-    public void reload() {
115
+    public void testReload() {
114 116
         Formatter.reload();
115 117
         
116 118
         final Set<String> s1 = Formatter.getFormats();

+ 0
- 6
test/com/dmdirc/ui/messages/StyliserTest.java ファイルの表示

@@ -8,12 +8,6 @@
8 8
 package com.dmdirc.ui.messages;
9 9
 
10 10
 import junit.framework.*;
11
-import javax.swing.text.BadLocationException;
12
-import javax.swing.text.SimpleAttributeSet;
13
-import javax.swing.text.StyleConstants;
14
-import javax.swing.text.StyledDocument;
15
-import com.dmdirc.logger.ErrorLevel;
16
-import com.dmdirc.logger.Logger;
17 11
 
18 12
 /**
19 13
  *

+ 6
- 5
test/com/dmdirc/updater/UpdateTest.java ファイルの表示

@@ -7,6 +7,7 @@
7 7
 
8 8
 package com.dmdirc.updater;
9 9
 
10
+import junit.framework.TestCase;
10 11
 import org.junit.AfterClass;
11 12
 import org.junit.Before;
12 13
 import org.junit.BeforeClass;
@@ -17,7 +18,7 @@ import static org.junit.Assert.*;
17 18
  *
18 19
  * @author chris
19 20
  */
20
-public class UpdateTest {
21
+public class UpdateTest extends TestCase {
21 22
     
22 23
     private final String subject = "outofdate component rversion lversion url";
23 24
     
@@ -40,22 +41,22 @@ public class UpdateTest {
40 41
     }
41 42
 
42 43
     @Test
43
-    public void getComponent() {
44
+    public void testGetComponent() {
44 45
         assertEquals("component", update.getComponent());
45 46
     }
46 47
 
47 48
     @Test
48
-    public void getLocalVersion() {
49
+    public void testGetLocalVersion() {
49 50
         assertEquals("lversion", update.getLocalVersion());
50 51
     }
51 52
 
52 53
     @Test
53
-    public void getRemoteVersion() {
54
+    public void testGetRemoteVersion() {
54 55
         assertEquals("rversion", update.getRemoteVersion());
55 56
     }
56 57
 
57 58
     @Test
58
-    public void getUrl() {
59
+    public void testGetUrl() {
59 60
         assertEquals("url", update.getUrl());
60 61
     }
61 62
     

読み込み中…
キャンセル
保存