Browse Source

Tests now use JUnit 4.x annotations

Removed useless imports and javadoc from tests

git-svn-id: http://svn.dmdirc.com/trunk@2376 00569f92-eb28-0410-84fd-f71c24880f
tags/0.5.5
Chris Smith 16 years ago
parent
commit
02eecebc72

+ 13
- 10
test/com/dmdirc/ProgramErrorTest.java View File

@@ -29,55 +29,58 @@ import com.dmdirc.logger.ProgramError;
29 29
 import java.util.Arrays;
30 30
 import java.util.Date;
31 31
 
32
-import junit.framework.*;
32
+import org.junit.Before;
33
+import org.junit.Test;
34
+import static org.junit.Assert.*;
33 35
 
34
-/**
35
- * Tests the ProgramError class
36
- */
37
-public class ProgramErrorTest extends TestCase {
36
+public class ProgramErrorTest {
38 37
     
39 38
     private ErrorLevel level;
40 39
     private String message;
41 40
     private String[] trace;
42 41
     private Date date;
43 42
     
44
-    public ProgramErrorTest(String testName) {
45
-        super(testName);
46
-    }
47
-    
48
-    protected void setUp() throws Exception {
43
+
44
+    @Before
45
+    public void setUp() throws Exception {
49 46
         level = ErrorLevel.HIGH;
50 47
         message = "Test error";
51 48
         trace = new String[]{"line 1", "line 2", };
52 49
         date = new Date(System.currentTimeMillis());
53 50
     }
54 51
     
52
+    @Test
55 53
     public void testGetLevel() {
56 54
         final ProgramError inst = new ProgramError(0, level, message, trace, date);
57 55
         assertEquals("Level check failed.", level, inst.getLevel());
58 56
     }
59 57
     
58
+    @Test
60 59
     public void testGetMessage() {
61 60
         final ProgramError inst = new ProgramError(0, level, message, trace, date);
62 61
         assertEquals("Message check failed.", message, inst.getMessage());
63 62
     }
64 63
     
64
+    @Test
65 65
     public void testGetTrace() {
66 66
         final ProgramError inst = new ProgramError(0, level, message, trace, date);
67 67
         assertTrue("Trace check failed", Arrays.equals(trace, inst.getTrace())); //NOPMD
68 68
     }
69 69
     
70
+    @Test
70 71
     public void testGetDate() {
71 72
         final ProgramError inst = new ProgramError(0, level, message, trace, date);
72 73
         assertTrue("Date check after failed.", inst.getDate().after(new Date(date.getTime() - 1)));
73 74
         assertTrue("Date check before failed.", inst.getDate().before(new Date(date.getTime() + 1)));
74 75
     }
75 76
     
77
+    @Test
76 78
     public void testGetStatus() {
77 79
         final ProgramError inst = new ProgramError(0, level, message, trace, date);
78 80
         assertEquals("Get status check failed.", ErrorReportStatus.WAITING, inst.getReportStatus());
79 81
     }
80 82
     
83
+    @Test
81 84
     public void testSetStatus() {
82 85
         final ProgramError inst = new ProgramError(0, level, message, trace, date);
83 86
         assertEquals("Get status check failed.", ErrorReportStatus.WAITING, inst.getReportStatus());

+ 5
- 22
test/com/dmdirc/ServerManagerTest.java View File

@@ -24,34 +24,17 @@ package com.dmdirc;
24 24
 
25 25
 import com.dmdirc.config.IdentityManager;
26 26
 import com.dmdirc.ui.dummy.DummyController;
27
-import junit.framework.TestCase;
28
-import org.junit.AfterClass;
27
+
29 28
 import org.junit.Before;
30
-import org.junit.BeforeClass;
31 29
 import org.junit.Test;
32 30
 import static org.junit.Assert.*;
33 31
 
34
-/**
35
- *
36
- * @author chris
37
- */
38
-public class ServerManagerTest extends TestCase {
39
-    
40
-    public ServerManagerTest() {
41
-        Main.setUI(new DummyController());
42
-        IdentityManager.load();
43
-    }
44
-    
45
-    @BeforeClass
46
-    public static void setUpClass() throws Exception {
47
-    }
48
-    
49
-    @AfterClass
50
-    public static void tearDownClass() throws Exception {
51
-    }
52
-    
32
+public class ServerManagerTest {
33
+        
53 34
     @Before
54 35
     public void setUp() throws Exception {
36
+        Main.setUI(new DummyController());
37
+        IdentityManager.load();
55 38
     }
56 39
     
57 40
     @Test

+ 3
- 29
test/com/dmdirc/StringTranscoderTest.java View File

@@ -23,39 +23,13 @@
23 23
 package com.dmdirc;
24 24
 
25 25
 import com.dmdirc.util.StringTranscoder;
26
+
26 27
 import java.nio.charset.Charset;
27
-import junit.framework.TestCase;
28
-import org.junit.After;
29
-import org.junit.AfterClass;
30
-import org.junit.Before;
31
-import org.junit.BeforeClass;
28
+
32 29
 import org.junit.Test;
33 30
 import static org.junit.Assert.*;
34 31
 
35
-/**
36
- *
37
- * @author Chris
38
- */
39
-public class StringTranscoderTest extends TestCase {
40
-    
41
-    public StringTranscoderTest() {
42
-    }
43
-
44
-    @BeforeClass
45
-    public static void setUpClass() throws Exception {
46
-    }
47
-
48
-    @AfterClass
49
-    public static void tearDownClass() throws Exception {
50
-    }
51
-
52
-    @Before
53
-    public void setUp() throws Exception {
54
-    }
55
-
56
-    @After
57
-    public void tearDown() throws Exception {
58
-    }
32
+public class StringTranscoderTest {
59 33
 
60 34
     @Test
61 35
     public void testTranscode() {

+ 5
- 6
test/com/dmdirc/WritableFrameContainerTest.java View File

@@ -23,14 +23,13 @@
23 23
 package com.dmdirc;
24 24
 
25 25
 import com.dmdirc.ui.interfaces.InputWindow;
26
-import junit.framework.*;
27 26
 
28
-public class WritableFrameContainerTest extends TestCase {
29
-    
30
-    public WritableFrameContainerTest(String testName) {
31
-        super(testName);
32
-    }
27
+import org.junit.Test;
28
+import static org.junit.Assert.*;
29
+
30
+public class WritableFrameContainerTest {
33 31
     
32
+    @Test
34 33
     public void testGetNumLines() {
35 34
         final WritableFrameContainer container10 = new BasicWritableFrameContainer(10);
36 35
         

+ 7
- 8
test/com/dmdirc/commandline/IrcAddressTest.java View File

@@ -22,16 +22,12 @@
22 22
 
23 23
 package com.dmdirc.commandline;
24 24
 
25
-import java.util.logging.Level;
26
-import java.util.logging.Logger;
27
-import junit.framework.*;
25
+import org.junit.Test;
26
+import static org.junit.Assert.*;
28 27
 
29
-public class IrcAddressTest extends TestCase {
30
-    
31
-    public IrcAddressTest(String testName) {
32
-        super(testName);
33
-    }
28
+public class IrcAddressTest {
34 29
     
30
+    @Test
35 31
     public void testBasic() {
36 32
         try {
37 33
             final IrcAddress address = new IrcAddress("irc://servername");
@@ -44,6 +40,7 @@ public class IrcAddressTest extends TestCase {
44 40
         }
45 41
     }
46 42
     
43
+    @Test
47 44
     public void testPasswordSSL() {
48 45
         try {
49 46
             final IrcAddress address = new IrcAddress("ircs://password@servername");
@@ -56,6 +53,7 @@ public class IrcAddressTest extends TestCase {
56 53
         }
57 54
     }
58 55
     
56
+    @Test
59 57
     public void testPortSSL() {
60 58
         try {
61 59
             final IrcAddress address = new IrcAddress("ircs://servername:+7000/");
@@ -68,6 +66,7 @@ public class IrcAddressTest extends TestCase {
68 66
         }
69 67
     }
70 68
     
69
+    @Test
71 70
     public void testComplex() {
72 71
         try {
73 72
             final IrcAddress address = new IrcAddress("ircs://password@servername:+7000/c1,c2,c3");

+ 1
- 20
test/com/dmdirc/commandparser/parsers/GlobalCommandParserTest.java View File

@@ -23,31 +23,12 @@
23 23
 package com.dmdirc.commandparser.parsers;
24 24
 
25 25
 import com.dmdirc.config.IdentityManager;
26
-import junit.framework.TestCase;
27
-import org.junit.AfterClass;
28 26
 import org.junit.Before;
29
-import org.junit.BeforeClass;
30 27
 import org.junit.Test;
31 28
 import static org.junit.Assert.*;
32 29
 
33
-/**
34
- *
35
- * @author chris
36
- */
37
-public class GlobalCommandParserTest extends TestCase {
30
+public class GlobalCommandParserTest {
38 31
     
39
-    public GlobalCommandParserTest() {
40
-    }
41
-
42
-    @BeforeClass
43
-    public static void setUpClass() throws Exception {
44
-        IdentityManager.load();
45
-    }
46
-
47
-    @AfterClass
48
-    public static void tearDownClass() throws Exception {
49
-    }
50
-
51 32
     @Before
52 33
     public void setUp() throws Exception {
53 34
         IdentityManager.load();

+ 13
- 15
test/com/dmdirc/config/ConfigTargetTest.java View File

@@ -22,28 +22,19 @@
22 22
 
23 23
 package com.dmdirc.config;
24 24
 
25
-import junit.framework.TestCase;
25
+import org.junit.Test;
26
+import static org.junit.Assert.*;
26 27
 
27
-/**
28
- *
29
- * @author chris
30
- */
31
-public class ConfigTargetTest extends TestCase {
32
-    
33
-    public ConfigTargetTest(String testName) {
34
-        super(testName);
35
-    }
36
-    
37
-    protected void setUp() throws Exception {
38
-        super.setUp();
39
-    }
28
+public class ConfigTargetTest {
40 29
     
30
+    @Test
41 31
     public void testDefault() {
42 32
         final ConfigTarget target = new ConfigTarget();
43 33
         
44 34
         assertEquals(target.getType(), ConfigTarget.TYPE.GLOBAL);
45 35
     }
46
-    
36
+
37
+    @Test
47 38
     public void testSetGlobal() {
48 39
         final ConfigTarget target = new ConfigTarget();
49 40
         target.setGlobal();
@@ -52,6 +43,7 @@ public class ConfigTargetTest extends TestCase {
52 43
         assertEquals(target.getTypeName(), "global");
53 44
     }
54 45
     
46
+    @Test
55 47
     public void testSetGlobalDefault() {
56 48
         final ConfigTarget target = new ConfigTarget();
57 49
         target.setGlobalDefault();
@@ -60,6 +52,7 @@ public class ConfigTargetTest extends TestCase {
60 52
         assertEquals(target.getTypeName(), "globaldefault");
61 53
     }
62 54
     
55
+    @Test
63 56
     public void testSetTheme() {
64 57
         final ConfigTarget target = new ConfigTarget();
65 58
         target.setTheme();
@@ -68,6 +61,7 @@ public class ConfigTargetTest extends TestCase {
68 61
         assertEquals(target.getTypeName(), "theme");
69 62
     }
70 63
     
64
+    @Test
71 65
     public void testSetProfile() {
72 66
         final ConfigTarget target = new ConfigTarget();
73 67
         target.setProfile();
@@ -76,6 +70,7 @@ public class ConfigTargetTest extends TestCase {
76 70
         assertEquals(target.getTypeName(), "profile");
77 71
     }
78 72
     
73
+    @Test
79 74
     public void testSetIrcd() {
80 75
         final ConfigTarget target = new ConfigTarget();
81 76
         target.setIrcd("ircd_name");
@@ -85,6 +80,7 @@ public class ConfigTargetTest extends TestCase {
85 80
         assertEquals(target.getData(), "ircd_name");
86 81
     }
87 82
     
83
+    @Test
88 84
     public void testSetNetwork() {
89 85
         final ConfigTarget target = new ConfigTarget();
90 86
         target.setNetwork("net_name");
@@ -94,6 +90,7 @@ public class ConfigTargetTest extends TestCase {
94 90
         assertEquals(target.getData(), "net_name");        
95 91
     }
96 92
     
93
+    @Test
97 94
     public void testSetServer() {
98 95
         final ConfigTarget target = new ConfigTarget();
99 96
         target.setServer("server_name");
@@ -103,6 +100,7 @@ public class ConfigTargetTest extends TestCase {
103 100
         assertEquals(target.getData(), "server_name");        
104 101
     }
105 102
     
103
+    @Test
106 104
     public void testSetChannel() {
107 105
         final ConfigTarget target = new ConfigTarget();
108 106
         target.setChannel("channel_name");

+ 7
- 13
test/com/dmdirc/config/IdentityManagerTest.java View File

@@ -22,24 +22,18 @@
22 22
 
23 23
 package com.dmdirc.config;
24 24
 
25
-import junit.framework.TestCase;
25
+import org.junit.Before;
26
+import org.junit.Test;
27
+import static org.junit.Assert.*;
26 28
 
27
-/**
28
- *
29
- * @author chris
30
- */
31
-public class IdentityManagerTest extends TestCase {
32
-    
33
-    public IdentityManagerTest(String testName) {
34
-        super(testName);
35
-    }
29
+public class IdentityManagerTest {
36 30
 
37
-    protected void setUp() throws Exception {
38
-        super.setUp();
39
-        
31
+    @Before
32
+    public void setUp() throws Exception {        
40 33
         IdentityManager.load();
41 34
     }
42 35
 
36
+    @Test
43 37
     public void testGetGlobalConfig() {
44 38
         final ConfigManager gcm = IdentityManager.getGlobalConfig();
45 39
         

+ 20
- 22
test/com/dmdirc/config/IdentityTest.java View File

@@ -22,35 +22,32 @@
22 22
 
23 23
 package com.dmdirc.config;
24 24
 
25
-import com.dmdirc.config.ConfigTarget;
26
-import com.dmdirc.config.Identity;
27 25
 import java.util.Properties;
28
-import junit.framework.*;
29 26
 
30
-/**
31
- *
32
- * @author chris
33
- */
34
-public class IdentityTest extends TestCase {
27
+import org.junit.After;
28
+import org.junit.Before;
29
+import org.junit.Test;
30
+import static org.junit.Assert.*;
31
+
32
+public class IdentityTest {
35 33
     
36 34
     private Identity myIdent;
37 35
     private ConfigTarget target;
38 36
     
39
-    public IdentityTest(String testName) {
40
-        super(testName);
41
-    }
42
-    
43
-    protected void setUp() throws Exception {
37
+    @Before
38
+    public void setUp() throws Exception {
44 39
         target = new ConfigTarget();
45 40
         target.setChannel("#unittest@unittest");
46 41
         
47 42
         myIdent = Identity.buildIdentity(target);
48 43
     }
49 44
     
50
-    protected void tearDown() throws Exception {
45
+    @After
46
+    public void tearDown() throws Exception {
51 47
         myIdent = null;
52 48
     }    
53 49
     
50
+    @Test
54 51
     public void testGetProperties() {
55 52
         myIdent.setOption("domain", "option", "value");
56 53
         final Properties props = myIdent.getProperties();
@@ -60,12 +57,14 @@ public class IdentityTest extends TestCase {
60 57
         myIdent.unsetOption("domain", "option");
61 58
     }
62 59
 
60
+    @Test
63 61
     public void testGetName() {
64 62
         final Properties props = myIdent.getProperties();
65 63
         
66 64
         assertEquals(props.getProperty("identity.name"), myIdent.getName());
67 65
     }
68 66
 
67
+    @Test
69 68
     public void testIsProfile() {
70 69
         assertFalse(myIdent.isProfile());
71 70
         
@@ -78,6 +77,7 @@ public class IdentityTest extends TestCase {
78 77
         myIdent.unsetOption("profile", "realname");
79 78
     }
80 79
 
80
+    @Test
81 81
     public void testHasOption() {
82 82
         assertFalse(myIdent.hasOption("has", "option"));
83 83
         
@@ -88,6 +88,7 @@ public class IdentityTest extends TestCase {
88 88
         myIdent.unsetOption("has", "option");
89 89
     }
90 90
 
91
+    @Test
91 92
     public void testGetOption() {
92 93
         myIdent.setOption("domain", "option", "value");
93 94
         final Properties props = myIdent.getProperties();
@@ -97,6 +98,7 @@ public class IdentityTest extends TestCase {
97 98
         myIdent.unsetOption("domain", "option");
98 99
     }
99 100
 
101
+    @Test
100 102
     public void testSetOption() {
101 103
         final int count = myIdent.getProperties().size();
102 104
         
@@ -107,6 +109,7 @@ public class IdentityTest extends TestCase {
107 109
         myIdent.unsetOption("foo", "bar");
108 110
     }
109 111
 
112
+    @Test
110 113
     public void testRemoveOption() {
111 114
         final Properties props = myIdent.getProperties();
112 115
         final int count = props.size();
@@ -117,6 +120,7 @@ public class IdentityTest extends TestCase {
117 120
         assertEquals(count, props.size());
118 121
     }
119 122
 
123
+    @Test
120 124
     public void testSave() {
121 125
         myIdent.setOption("foo", "bar", "baz!");
122 126
         
@@ -131,21 +135,15 @@ public class IdentityTest extends TestCase {
131 135
         myIdent.save();
132 136
     }
133 137
 
138
+    @Test
134 139
     public void testGetTarget() {
135 140
         assertEquals(target.getData(), myIdent.getTarget().getData());
136 141
         assertEquals(target.getType(), myIdent.getTarget().getType());
137 142
     }
138 143
 
144
+    @Test
139 145
     public void testToString() {
140 146
         assertEquals(myIdent.getOption("identity", "name"), myIdent.getName());
141 147
     }
142
-
143
-    public void testCompareTo() {
144
-        // TODO add your test code.
145
-    }
146
-
147
-    public void testBuildIdentity() {
148
-        // TODO add your test code.
149
-    }
150 148
     
151 149
 }

+ 4
- 10
test/com/dmdirc/config/InvalidIdentityFileExceptionTest.java View File

@@ -22,18 +22,12 @@
22 22
 
23 23
 package com.dmdirc.config;
24 24
 
25
-import junit.framework.TestCase;
25
+import org.junit.Test;
26
+import static org.junit.Assert.*;
26 27
 
27
-/**
28
- *
29
- * @author chris
30
- */
31
-public class InvalidIdentityFileExceptionTest extends TestCase {
32
-    
33
-    public InvalidIdentityFileExceptionTest(String testName) {
34
-        super(testName);
35
-    }
28
+public class InvalidIdentityFileExceptionTest {
36 29
 
30
+    @Test
37 31
     public void testMessage() {
38 32
         final InvalidIdentityFileException ex = new InvalidIdentityFileException("message here");
39 33
         

+ 17
- 14
test/com/dmdirc/parser/ClientInfoTest.java View File

@@ -24,18 +24,13 @@ package com.dmdirc.parser;
24 24
 
25 25
 import java.util.HashMap;
26 26
 import java.util.Map;
27
-import junit.framework.TestCase;
28 27
 
29
-/**
30
- *
31
- * @author chris
32
- */
33
-public class ClientInfoTest extends TestCase {
34
-    
35
-    public ClientInfoTest(String testName) {
36
-        super(testName);
37
-    }
28
+import org.junit.Test;
29
+import static org.junit.Assert.*;
30
+
31
+public class ClientInfoTest {
38 32
     
33
+    @Test
39 34
     public void testMap() {
40 35
         final ClientInfo ci = new ClientInfo(null, "nick!ident@host");
41 36
         final Map map = new HashMap();
@@ -44,6 +39,7 @@ public class ClientInfoTest extends TestCase {
44 39
         assertEquals(map, ci.getMap());
45 40
     }
46 41
     
42
+    @Test
47 43
     public void testFake() {
48 44
         final ClientInfo ci = new ClientInfo(null, "nick!ident@host");
49 45
         assertFalse(ci.isFake());
@@ -53,6 +49,7 @@ public class ClientInfoTest extends TestCase {
53 49
         assertFalse(ci.isFake());
54 50
     }
55 51
     
52
+    @Test
56 53
     public void testParseHost() {
57 54
         final String string1 = ":nick!ident@host";
58 55
         final String string2 = "nick";
@@ -63,6 +60,7 @@ public class ClientInfoTest extends TestCase {
63 60
         assertEquals("nick", ClientInfo.parseHost(string3));
64 61
     }
65 62
     
63
+    @Test
66 64
     public void testParseHostFull() {
67 65
         final String string1 = ":nick!ident@host";
68 66
         final String string2 = "nick";
@@ -77,6 +75,7 @@ public class ClientInfoTest extends TestCase {
77 75
         assertEquals("host", ClientInfo.parseHostFull(string3)[2]);
78 76
     }
79 77
     
78
+    @Test
80 79
     public void testSetUserBits() {
81 80
         final ClientInfo ci = new ClientInfo(null, "nick!ident@host");
82 81
         ci.setUserBits("nick2!ident2@host2", false);
@@ -89,14 +88,16 @@ public class ClientInfoTest extends TestCase {
89 88
         
90 89
         assertEquals("nick3", ci.getNickname());
91 90
         assertEquals("ident2", ci.getIdent());
92
-        assertEquals("host3", ci.getHost());        
91
+        assertEquals("host3", ci.getHost());
93 92
     }
94 93
     
94
+    @Test
95 95
     public void testToString() {
96 96
         final ClientInfo ci = new ClientInfo(null, "nick!ident@host");
97 97
         assertEquals("nick!ident@host", ci.toString());
98 98
     }
99 99
     
100
+    @Test
100 101
     public void testAwayState() {
101 102
         final ClientInfo ci = new ClientInfo(null, "nick!ident@host");
102 103
         assertFalse(ci.getAwayState());
@@ -104,6 +105,7 @@ public class ClientInfoTest extends TestCase {
104 105
         assertTrue(ci.getAwayState());
105 106
     }
106 107
     
108
+    @Test
107 109
     public void testAwayReason() {
108 110
         final ClientInfo ci = new ClientInfo(null, "nick!ident@host");
109 111
         ci.setAwayState(true);
@@ -113,13 +115,14 @@ public class ClientInfoTest extends TestCase {
113 115
         ci.setAwayState(false);
114 116
         assertEquals("", ci.getAwayReason());
115 117
     }
116
-        
118
+    
119
+    @Test
117 120
     public void testRealName() {
118 121
         final ClientInfo ci = new ClientInfo(null, "nick!ident@host");
119 122
         ci.setRealName("abc def");
120 123
         assertEquals("abc def", ci.getRealName());
121 124
         ci.setRealName("abc 123 def");
122
-        assertEquals("abc 123 def", ci.getRealName());        
125
+        assertEquals("abc 123 def", ci.getRealName());
123 126
     }
124
-        
127
+    
125 128
 }

+ 2
- 9
test/com/dmdirc/parser/IRCParserTest.java View File

@@ -24,18 +24,11 @@ package com.dmdirc.parser;
24 24
 
25 25
 import com.dmdirc.parser.callbacks.CallbackNotFoundException;
26 26
 import com.dmdirc.parser.callbacks.interfaces.IAwayState;
27
-import junit.framework.TestCase;
27
+
28 28
 import org.junit.Test;
29 29
 import static org.junit.Assert.*;
30 30
 
31
-/**
32
- *
33
- * @author Chris
34
- */
35
-public class IRCParserTest extends TestCase {
36
-    
37
-    public IRCParserTest() {
38
-    }
31
+public class IRCParserTest {
39 32
     
40 33
     @Test
41 34
     public void testIssue042() {

+ 10
- 10
test/com/dmdirc/parser/ServerInfoTest.java View File

@@ -22,18 +22,12 @@
22 22
 
23 23
 package com.dmdirc.parser;
24 24
 
25
-import junit.framework.TestCase;
25
+import org.junit.Test;
26
+import static org.junit.Assert.*;
26 27
 
27
-/**
28
- *
29
- * @author chris
30
- */
31
-public class ServerInfoTest extends TestCase {
32
-    
33
-    public ServerInfoTest(String testName) {
34
-        super(testName);
35
-    }
28
+public class ServerInfoTest {
36 29
     
30
+    @Test
37 31
     public void testHost() {
38 32
         final ServerInfo si = new ServerInfo("host0", 5, "");
39 33
         assertEquals("host0", si.getHost());
@@ -41,6 +35,7 @@ public class ServerInfoTest extends TestCase {
41 35
         assertEquals("host1", si.getHost());
42 36
     }
43 37
     
38
+    @Test
44 39
     public void testPort() {
45 40
         final ServerInfo si = new ServerInfo("host0", 5, "");
46 41
         assertEquals(5, si.getPort());
@@ -48,6 +43,7 @@ public class ServerInfoTest extends TestCase {
48 43
         assertEquals(65530, si.getPort());
49 44
     }
50 45
     
46
+    @Test
51 47
     public void testPassword() {
52 48
         final ServerInfo si = new ServerInfo("host0", 5, "pass1");
53 49
         assertEquals("pass1", si.getPassword());
@@ -55,6 +51,7 @@ public class ServerInfoTest extends TestCase {
55 51
         assertEquals("pass2", si.getPassword());
56 52
     }
57 53
     
54
+    @Test
58 55
     public void testSSL() {
59 56
         final ServerInfo si = new ServerInfo("host0", 5, "pass1");
60 57
         assertFalse(si.getSSL());
@@ -62,6 +59,7 @@ public class ServerInfoTest extends TestCase {
62 59
         assertTrue(si.getSSL());
63 60
     }
64 61
     
62
+    @Test
65 63
     public void testUseSocks() {
66 64
         final ServerInfo si = new ServerInfo("host0", 5, "pass1");
67 65
         assertFalse(si.getUseSocks());
@@ -69,12 +67,14 @@ public class ServerInfoTest extends TestCase {
69 67
         assertTrue(si.getUseSocks());
70 68
     }
71 69
     
70
+    @Test
72 71
     public void testProxyHost() {
73 72
         final ServerInfo si = new ServerInfo("host0", 5, "pass1");
74 73
         si.setProxyHost("foo");
75 74
         assertEquals("foo", si.getProxyHost());
76 75
     }
77 76
     
77
+    @Test
78 78
     public void testProxyPort() {
79 79
         final ServerInfo si = new ServerInfo("host0", 5, "pass1");
80 80
         si.setProxyPort(1024);

+ 12
- 10
test/com/dmdirc/ui/messages/ColourManagerTest.java View File

@@ -23,20 +23,21 @@
23 23
 package com.dmdirc.ui.messages;
24 24
 
25 25
 import com.dmdirc.config.IdentityManager;
26
-import junit.framework.*;
26
+
27 27
 import java.awt.Color;
28 28
 
29
-/**
30
- *
31
- * @author chris
32
- */
33
-public class ColourManagerTest extends TestCase {
29
+import org.junit.Before;
30
+import org.junit.Test;
31
+import static org.junit.Assert.*;
32
+
33
+public class ColourManagerTest {
34 34
     
35
-    public ColourManagerTest(String testName) {
36
-        super(testName);
35
+    @Before
36
+    public void setUp() throws Exception {
37 37
         IdentityManager.load();
38 38
     }
39
-    
39
+
40
+    @Test
40 41
     public void testGetColourInt() {
41 42
         int spec = 4;
42 43
         
@@ -44,7 +45,8 @@ public class ColourManagerTest extends TestCase {
44 45
         Color result = ColourManager.getColour(spec);
45 46
         assertEquals(expResult, result);
46 47
     }
47
-    
48
+
49
+    @Test
48 50
     public void testGetColourHex() {
49 51
         String spec = "FFFFFF";
50 52
         

+ 4
- 25
test/com/dmdirc/ui/messages/FormatterTest.java View File

@@ -24,36 +24,19 @@ package com.dmdirc.ui.messages;
24 24
 
25 25
 import com.dmdirc.Main;
26 26
 import com.dmdirc.config.IdentityManager;
27
+
27 28
 import java.io.File;
28 29
 import java.util.Set;
29
-import junit.framework.TestCase;
30
-import org.junit.AfterClass;
30
+
31 31
 import org.junit.Before;
32
-import org.junit.BeforeClass;
33 32
 import org.junit.Test;
34 33
 import static org.junit.Assert.*;
35 34
 
36
-/**
37
- *
38
- * @author chris
39
- */
40
-public class FormatterTest extends TestCase {
35
+public class FormatterTest {
41 36
     
42
-    public FormatterTest() {
43
-        IdentityManager.load();
44
-    }
45
-
46
-    @BeforeClass
47
-    public static void setUpClass() throws Exception {
48
-
49
-    }
50
-
51
-    @AfterClass
52
-    public static void tearDownClass() throws Exception {
53
-    }
54
-
55 37
     @Before
56 38
     public void setUp() throws Exception {
39
+        IdentityManager.load();
57 40
     }
58 41
 
59 42
     @Test
@@ -96,10 +79,6 @@ public class FormatterTest extends TestCase {
96 79
         }
97 80
     }
98 81
 
99
-    @Test
100
-    public void testRegisterDefault() {
101
-    }
102
-
103 82
     @Test
104 83
     public void testSaveAndLoad() {
105 84
         Formatter.registerDefault("unitTest_saveLoad", "");

+ 9
- 11
test/com/dmdirc/ui/messages/StyliserTest.java View File

@@ -22,18 +22,12 @@
22 22
 
23 23
 package com.dmdirc.ui.messages;
24 24
 
25
-import junit.framework.*;
25
+import org.junit.Test;
26
+import static org.junit.Assert.*;
26 27
 
27
-/**
28
- *
29
- * @author chris
30
- */
31
-public class StyliserTest extends TestCase {
28
+public class StyliserTest {
32 29
     
33
-    public StyliserTest(String testName) {
34
-        super(testName);
35
-    }
36
-        
30
+    @Test
37 31
     public void testStripControlCodes1() {
38 32
         String input = "This"+((char) 2)+" is "+((char) 17)+"a test";
39 33
         
@@ -42,14 +36,16 @@ public class StyliserTest extends TestCase {
42 36
         assertEquals(expResult, result);
43 37
     }
44 38
     
39
+    @Test
45 40
     public void testStripControlCodes2() {
46 41
         String input = "This is "+((char) 3)+"5a "+((char) 4)+"FF0000test";
47 42
         
48 43
         String expResult = "This is a test";
49 44
         String result = Styliser.stipControlCodes(input);
50 45
         assertEquals(expResult, result);
51
-    }    
46
+    }
52 47
     
48
+    @Test
53 49
     public void testReadUntilControl1() {
54 50
         String input = "This"+((char) 2)+" is "+((char) 17)+"a test";
55 51
         String expResult = "This";
@@ -57,6 +53,7 @@ public class StyliserTest extends TestCase {
57 53
         assertEquals(expResult, result);
58 54
     }
59 55
     
56
+    @Test
60 57
     public void testReadUntilControl2() {
61 58
         String input = "This"+((char) 17)+" is "+((char) 17)+"a test";
62 59
         String expResult = "This";
@@ -64,6 +61,7 @@ public class StyliserTest extends TestCase {
64 61
         assertEquals(expResult, result);
65 62
     }
66 63
     
64
+    @Test
67 65
     public void testReadUntilControl3() {
68 66
         String input = ((char) 31)+" is "+((char) 17)+"a test";
69 67
         String expResult = "";

+ 1
- 19
test/com/dmdirc/updater/UpdateTest.java View File

@@ -22,33 +22,15 @@
22 22
 
23 23
 package com.dmdirc.updater;
24 24
 
25
-import junit.framework.TestCase;
26
-import org.junit.AfterClass;
27 25
 import org.junit.Before;
28
-import org.junit.BeforeClass;
29 26
 import org.junit.Test;
30 27
 import static org.junit.Assert.*;
31 28
 
32
-/**
33
- *
34
- * @author chris
35
- */
36
-public class UpdateTest extends TestCase {
29
+public class UpdateTest {
37 30
     
38 31
     private final String subject = "outofdate component rversion lversion url";
39 32
     
40 33
     private Update update;
41
-    
42
-    public UpdateTest() {
43
-    }
44
-
45
-    @BeforeClass
46
-    public static void setUpClass() throws Exception {
47
-    }
48
-
49
-    @AfterClass
50
-    public static void tearDownClass() throws Exception {
51
-    }
52 34
 
53 35
     @Before
54 36
     public void setUp() throws Exception {

Loading…
Cancel
Save