Kaynağa Gözat

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 yıl önce
ebeveyn
işleme
065ab57e1b

+ 7
- 6
test/com/dmdirc/ServerManagerTest.java Dosyayı Görüntüle

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

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

+ 11
- 9
test/com/dmdirc/actions/ActionManagerTest.java Dosyayı Görüntüle

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

+ 4
- 3
test/com/dmdirc/actions/CoreActionMetaTypeTest.java Dosyayı Görüntüle

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

+ 3
- 2
test/com/dmdirc/commandparser/GlobalCommandParserTest.java Dosyayı Görüntüle

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

+ 3
- 2
test/com/dmdirc/parser/IRCParserTest.java Dosyayı Görüntüle

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

+ 11
- 9
test/com/dmdirc/ui/messages/FormatterTest.java Dosyayı Görüntüle

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

+ 0
- 6
test/com/dmdirc/ui/messages/StyliserTest.java Dosyayı Görüntüle

8
 package com.dmdirc.ui.messages;
8
 package com.dmdirc.ui.messages;
9
 
9
 
10
 import junit.framework.*;
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 Dosyayı Görüntüle

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

Loading…
İptal
Kaydet