Kaynağa Gözat

Automatic test tidying.

pull/660/head
Chris Smith 8 yıl önce
ebeveyn
işleme
767a156a87

+ 29
- 42
test/com/dmdirc/config/ConfigFileBackedConfigProviderTest.java Dosyayı Görüntüle

@@ -74,25 +74,25 @@ public class ConfigFileBackedConfigProviderTest {
74 74
     }
75 75
 
76 76
     @Test(expected = InvalidIdentityFileException.class)
77
-    public void testNoName() throws IOException, InvalidIdentityFileException {
77
+    public void testNoName() throws Exception {
78 78
         new ConfigFileBackedConfigProvider(identityManager,
79 79
                 jimFsRule.getPath("no-name"), false);
80 80
     }
81 81
 
82 82
     @Test(expected = InvalidIdentityFileException.class)
83
-    public void testNoTarget() throws IOException, InvalidIdentityFileException {
83
+    public void testNoTarget() throws Exception {
84 84
         new ConfigFileBackedConfigProvider(identityManager,
85 85
                 jimFsRule.getPath("no-target"), false);
86 86
     }
87 87
 
88 88
     @Test(expected = InvalidIdentityFileException.class)
89
-    public void testInvalidConfigFile() throws IOException, InvalidIdentityFileException {
89
+    public void testInvalidConfigFile() throws Exception {
90 90
         new ConfigFileBackedConfigProvider(identityManager,
91 91
                 jimFsRule.getPath("invalid-config-file"), false);
92 92
     }
93 93
 
94 94
     @Test
95
-    public void testProfileSimple() throws IOException, InvalidIdentityFileException {
95
+    public void testProfileSimple() throws Exception {
96 96
         final ConfigFileBackedConfigProvider provider = getProvider("profile-new");
97 97
         assertTrue(provider.isProfile());
98 98
         assertEquals("nick1\nnick2\nnick3", provider.getOption("profile", "nicknames"));
@@ -101,34 +101,33 @@ public class ConfigFileBackedConfigProviderTest {
101 101
     }
102 102
 
103 103
     @Test
104
-    public void testProfileNonProfileConfig() throws IOException, InvalidIdentityFileException {
104
+    public void testProfileNonProfileConfig() throws Exception {
105 105
         final ConfigFileBackedConfigProvider provider = getProvider("simple-ircd");
106 106
         assertFalse(provider.isProfile());
107 107
     }
108 108
 
109 109
     @Test
110
-    public void testReadsIrcdTarget() throws IOException, InvalidIdentityFileException {
110
+    public void testReadsIrcdTarget() throws Exception {
111 111
         final ConfigFileBackedConfigProvider provider = getProvider("simple-ircd");
112 112
         assertEquals(ConfigTarget.TYPE.IRCD, provider.getTarget().getType());
113 113
         assertEquals("DMDircircd!", provider.getTarget().getData());
114 114
     }
115 115
 
116 116
     @Test
117
-    public void testReadsServerTarget() throws IOException, InvalidIdentityFileException {
117
+    public void testReadsServerTarget() throws Exception {
118 118
         final ConfigFileBackedConfigProvider provider = getProvider("simple-server");
119 119
         assertEquals(ConfigTarget.TYPE.SERVER, provider.getTarget().getType());
120 120
         assertEquals("test123", provider.getTarget().getData());
121 121
     }
122 122
 
123 123
     @Test
124
-    public void testSetsOrder() throws IOException, InvalidIdentityFileException {
124
+    public void testSetsOrder() throws Exception {
125 125
         final ConfigFileBackedConfigProvider provider = getProvider("simple-ircd");
126 126
         assertEquals(5000, provider.getTarget().getOrder());
127 127
     }
128 128
 
129 129
     @Test
130
-    public void testHasOptionPermissiveValidator()
131
-            throws IOException, InvalidIdentityFileException {
130
+    public void testHasOptionPermissiveValidator() throws Exception {
132 131
         final ConfigFileBackedConfigProvider provider = getProvider("simple-ircd");
133 132
         assertTrue(provider.hasOption("unit", "test", PERMISSIVE_VALIDATOR));
134 133
         assertFalse(provider.hasOption("unit", "untest", PERMISSIVE_VALIDATOR));
@@ -136,62 +135,60 @@ public class ConfigFileBackedConfigProviderTest {
136 135
     }
137 136
 
138 137
     @Test
139
-    public void testHasOptionFailingValidator() throws IOException, InvalidIdentityFileException {
138
+    public void testHasOptionFailingValidator() throws Exception {
140 139
         final ConfigFileBackedConfigProvider provider = getProvider("simple-ircd");
141 140
         assertFalse(provider.hasOption("unit", "test", new NumericalValidator(0, 100)));
142 141
     }
143 142
 
144 143
     @Test
145
-    public void testGetOptionPermissioveValidator()
146
-            throws IOException, InvalidIdentityFileException {
144
+    public void testGetOptionPermissioveValidator() throws Exception {
147 145
         final ConfigFileBackedConfigProvider provider = getProvider("simple-ircd");
148 146
         assertEquals("true", provider.getOption("unit", "test", PERMISSIVE_VALIDATOR));
149 147
     }
150 148
 
151 149
     @Test
152
-    public void testGetOptionFailingValidator() throws IOException, InvalidIdentityFileException {
150
+    public void testGetOptionFailingValidator() throws Exception {
153 151
         final ConfigFileBackedConfigProvider provider = getProvider("simple-ircd");
154 152
         assertNull(provider.getOption("unit", "test", new NumericalValidator(0, 100)));
155 153
     }
156 154
 
157 155
     @Test
158
-    public void testUnsetOption() throws IOException, InvalidIdentityFileException {
156
+    public void testUnsetOption() throws Exception {
159 157
         final ConfigFileBackedConfigProvider provider = getProvider("simple-ircd");
160 158
         provider.unsetOption("unit", "test");
161 159
         assertFalse(provider.hasOption("unit", "test", PERMISSIVE_VALIDATOR));
162 160
     }
163 161
 
164 162
     @Test
165
-    public void testSetOptionBoolean() throws IOException, InvalidIdentityFileException {
163
+    public void testSetOptionBoolean() throws Exception {
166 164
         final ConfigFileBackedConfigProvider provider = getProvider("simple-ircd");
167 165
         provider.setOption("new", "option", true);
168 166
         assertEquals("true", provider.getOption("new", "option", PERMISSIVE_VALIDATOR));
169 167
     }
170 168
 
171 169
     @Test
172
-    public void testSetOptionInt() throws IOException, InvalidIdentityFileException {
170
+    public void testSetOptionInt() throws Exception {
173 171
         final ConfigFileBackedConfigProvider provider = getProvider("simple-ircd");
174 172
         provider.setOption("new", "option", 1234);
175 173
         assertEquals("1234", provider.getOption("new", "option", PERMISSIVE_VALIDATOR));
176 174
     }
177 175
 
178 176
     @Test
179
-    public void testSetOptionList() throws IOException, InvalidIdentityFileException {
177
+    public void testSetOptionList() throws Exception {
180 178
         final ConfigFileBackedConfigProvider provider = getProvider("simple-ircd");
181 179
         provider.setOption("new", "option", Lists.newArrayList("first", "second"));
182 180
         assertEquals("first\nsecond", provider.getOption("new", "option", PERMISSIVE_VALIDATOR));
183 181
     }
184 182
 
185 183
     @Test
186
-    public void testSetOptionListWithSingleEntry()
187
-            throws IOException, InvalidIdentityFileException {
184
+    public void testSetOptionListWithSingleEntry() throws Exception {
188 185
         final ConfigFileBackedConfigProvider provider = getProvider("simple-ircd");
189 186
         provider.setOption("new", "option", Lists.newArrayList("first"));
190 187
         assertEquals("first", provider.getOption("new", "option", PERMISSIVE_VALIDATOR));
191 188
     }
192 189
 
193 190
     @Test
194
-    public void testSaveSimple() throws IOException, InvalidIdentityFileException {
191
+    public void testSaveSimple() throws Exception {
195 192
         final ConfigFileBackedConfigProvider provider = getProvider("simple-ircd");
196 193
         provider.setOption("newdomain", "test123", 47);
197 194
         provider.save();
@@ -207,7 +204,7 @@ public class ConfigFileBackedConfigProviderTest {
207 204
     }
208 205
 
209 206
     @Test
210
-    public void testFiresSettingChanged() throws IOException, InvalidIdentityFileException {
207
+    public void testFiresSettingChanged() throws Exception {
211 208
         final ConfigFileBackedConfigProvider provider = getProvider("simple-ircd");
212 209
         provider.addListener(changeListener);
213 210
         provider.setOption("new", "option", "boo");
@@ -215,8 +212,7 @@ public class ConfigFileBackedConfigProviderTest {
215 212
     }
216 213
 
217 214
     @Test
218
-    public void testDoesNotFireSettingChangedIfValueIsSame()
219
-            throws IOException, InvalidIdentityFileException {
215
+    public void testDoesNotFireSettingChangedIfValueIsSame() throws Exception {
220 216
         final ConfigFileBackedConfigProvider provider = getProvider("simple-ircd");
221 217
         provider.setOption("new", "option", "boo");
222 218
         provider.addListener(changeListener);
@@ -225,8 +221,7 @@ public class ConfigFileBackedConfigProviderTest {
225 221
     }
226 222
 
227 223
     @Test
228
-    public void testFiresSettingChangedWhenUnset()
229
-            throws IOException, InvalidIdentityFileException {
224
+    public void testFiresSettingChangedWhenUnset() throws Exception {
230 225
         final ConfigFileBackedConfigProvider provider = getProvider("simple-ircd");
231 226
         provider.setOption("new", "option", "boo");
232 227
         provider.addListener(changeListener);
@@ -235,8 +230,7 @@ public class ConfigFileBackedConfigProviderTest {
235 230
     }
236 231
 
237 232
     @Test
238
-    public void testDoesNotFireSettingChangedIfNonExistantOptionUnset()
239
-            throws IOException, InvalidIdentityFileException {
233
+    public void testDoesNotFireSettingChangedIfNonExistantOptionUnset() throws Exception {
240 234
         final ConfigFileBackedConfigProvider provider = getProvider("simple-ircd");
241 235
         provider.addListener(changeListener);
242 236
         provider.unsetOption("new", "option");
@@ -244,8 +238,7 @@ public class ConfigFileBackedConfigProviderTest {
244 238
     }
245 239
 
246 240
     @Test
247
-    public void testDoesNotFireSettingChangedIfRemoved()
248
-            throws IOException, InvalidIdentityFileException {
241
+    public void testDoesNotFireSettingChangedIfRemoved() throws Exception {
249 242
         final ConfigFileBackedConfigProvider provider = getProvider("simple-ircd");
250 243
         provider.addListener(changeListener);
251 244
         provider.removeListener(changeListener);
@@ -254,8 +247,7 @@ public class ConfigFileBackedConfigProviderTest {
254 247
     }
255 248
 
256 249
     @Test
257
-    public void testReloadLoadsExtraSettings()
258
-            throws IOException, InvalidConfigFileException, InvalidIdentityFileException {
250
+    public void testReloadLoadsExtraSettings() throws Exception {
259 251
         final ConfigFileBackedConfigProvider provider = getProvider("simple-ircd");
260 252
         copyFileAndReload(provider);
261 253
         assertTrue(provider.hasOption("more", "settings", PERMISSIVE_VALIDATOR));
@@ -263,16 +255,14 @@ public class ConfigFileBackedConfigProviderTest {
263 255
     }
264 256
 
265 257
     @Test
266
-    public void testReloadUnsetsMissingSettings()
267
-            throws IOException, InvalidConfigFileException, InvalidIdentityFileException {
258
+    public void testReloadUnsetsMissingSettings() throws Exception {
268 259
         final ConfigFileBackedConfigProvider provider = getProvider("simple-ircd");
269 260
         copyFileAndReload(provider);
270 261
         assertFalse(provider.hasOption("unit", "test", PERMISSIVE_VALIDATOR));
271 262
     }
272 263
 
273 264
     @Test
274
-    public void testReloadFiresSettingChangedForChangedOptions()
275
-            throws IOException, InvalidConfigFileException, InvalidIdentityFileException {
265
+    public void testReloadFiresSettingChangedForChangedOptions() throws Exception {
276 266
         final ConfigFileBackedConfigProvider provider = getProvider("simple-ircd");
277 267
         provider.addListener(changeListener);
278 268
         copyFileAndReload(provider);
@@ -280,8 +270,7 @@ public class ConfigFileBackedConfigProviderTest {
280 270
     }
281 271
 
282 272
     @Test
283
-    public void testReloadFiresSettingChangedForNewOptions()
284
-            throws IOException, InvalidConfigFileException, InvalidIdentityFileException {
273
+    public void testReloadFiresSettingChangedForNewOptions() throws Exception {
285 274
         final ConfigFileBackedConfigProvider provider = getProvider("simple-ircd");
286 275
         provider.addListener(changeListener);
287 276
         copyFileAndReload(provider);
@@ -292,8 +281,7 @@ public class ConfigFileBackedConfigProviderTest {
292 281
     }
293 282
 
294 283
     @Test
295
-    public void testReloadFiresSettingChangedForRemovedOptions()
296
-            throws IOException, InvalidConfigFileException, InvalidIdentityFileException {
284
+    public void testReloadFiresSettingChangedForRemovedOptions() throws Exception {
297 285
         final ConfigFileBackedConfigProvider provider = getProvider("simple-ircd");
298 286
         provider.addListener(changeListener);
299 287
         copyFileAndReload(provider);
@@ -301,8 +289,7 @@ public class ConfigFileBackedConfigProviderTest {
301 289
     }
302 290
 
303 291
     @Test
304
-    public void testReloadDoesNotFireSettingChangedForUnchangedOptions()
305
-            throws IOException, InvalidConfigFileException, InvalidIdentityFileException {
292
+    public void testReloadDoesNotFireSettingChangedForUnchangedOptions() throws Exception {
306 293
         final ConfigFileBackedConfigProvider provider = getProvider("simple-ircd");
307 294
         provider.addListener(changeListener);
308 295
         copyFileAndReload(provider);

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

@@ -146,35 +146,35 @@ public class ConfigTargetTest {
146 146
         t4.setServer("abc");
147 147
         t5.setChannel("abc");
148 148
 
149
-        assertTrue(t1.equals(t1));
149
+        assertEquals(t1, t1);
150 150
         assertFalse(t1.equals(t2));
151 151
         assertFalse(t1.equals(t3));
152 152
         assertFalse(t1.equals(t4));
153
-        assertTrue(t1.equals(t5));
153
+        assertEquals(t1, t5);
154 154
 
155 155
         assertFalse(t2.equals(t1));
156
-        assertTrue(t2.equals(t2));
156
+        assertEquals(t2, t2);
157 157
         assertFalse(t2.equals(t3));
158 158
         assertFalse(t2.equals(t4));
159 159
         assertFalse(t2.equals(t5));
160 160
 
161 161
         assertFalse(t3.equals(t1));
162 162
         assertFalse(t3.equals(t2));
163
-        assertTrue(t3.equals(t3));
163
+        assertEquals(t3, t3);
164 164
         assertFalse(t3.equals(t4));
165 165
         assertFalse(t3.equals(t5));
166 166
 
167 167
         assertFalse(t4.equals(t1));
168 168
         assertFalse(t4.equals(t2));
169 169
         assertFalse(t4.equals(t3));
170
-        assertTrue(t4.equals(t4));
170
+        assertEquals(t4, t4);
171 171
         assertFalse(t4.equals(t5));
172 172
 
173
-        assertTrue(t5.equals(t1));
173
+        assertEquals(t5, t1);
174 174
         assertFalse(t5.equals(t2));
175 175
         assertFalse(t5.equals(t3));
176 176
         assertFalse(t5.equals(t4));
177
-        assertTrue(t5.equals(t5));
177
+        assertEquals(t5, t5);
178 178
 
179 179
         assertEquals(t1.hashCode(), t5.hashCode());
180 180
     }

+ 1
- 2
test/com/dmdirc/config/IdentityManagerTest.java Dosyayı Görüntüle

@@ -81,8 +81,7 @@ public class IdentityManagerTest {
81 81
     }
82 82
 
83 83
     @Test
84
-    public void testDoesNotCreateProfileIfOneExists()
85
-            throws IOException, InvalidIdentityFileException {
84
+    public void testDoesNotCreateProfileIfOneExists() throws Exception {
86 85
         Files.createDirectories(identitiesDirectory);
87 86
         Files.copy(getClass().getResourceAsStream("profile-new"),
88 87
                 identitiesDirectory.resolve("profile"));

+ 3
- 3
test/com/dmdirc/logger/ProgramErrorTest.java Dosyayı Görüntüle

@@ -135,9 +135,9 @@ public class ProgramErrorTest {
135 135
         assertFalse(pe1.equals(null)); // NOPMD
136 136
         assertFalse(pe1.equals("moo"));
137 137
 
138
-        assertTrue(pe1.equals(pe2));
139
-        assertTrue(pe1.equals(pe1));
140
-        assertTrue(pe2.equals(pe1));
138
+        assertEquals(pe1, pe2);
139
+        assertEquals(pe1, pe1);
140
+        assertEquals(pe2, pe1);
141 141
 
142 142
         assertFalse(pe1.equals(pe3));
143 143
         assertFalse(pe1.equals(pe4));

+ 6
- 4
test/com/dmdirc/ui/core/feedback/CoreFeedbackDialogModelTest.java Dosyayı Görüntüle

@@ -33,6 +33,8 @@ import org.mockito.Mock;
33 33
 import org.mockito.runners.MockitoJUnitRunner;
34 34
 
35 35
 import static org.junit.Assert.assertEquals;
36
+import static org.junit.Assert.assertFalse;
37
+import static org.junit.Assert.assertTrue;
36 38
 import static org.mockito.Matchers.anyString;
37 39
 import static org.mockito.Mockito.verify;
38 40
 import static org.mockito.Mockito.when;
@@ -81,16 +83,16 @@ public class CoreFeedbackDialogModelTest {
81 83
 
82 84
     @Test
83 85
     public void testServerInfo() {
84
-        assertEquals("testServerInfo", false, instance.getIncludeServerInfo());
86
+        assertFalse("testServerInfo", instance.getIncludeServerInfo());
85 87
         instance.setIncludeServerInfo(true);
86
-        assertEquals("testServerInfo", true, instance.getIncludeServerInfo());
88
+        assertTrue("testServerInfo", instance.getIncludeServerInfo());
87 89
     }
88 90
 
89 91
     @Test
90 92
     public void testDMDircInfo() {
91
-        assertEquals("testDMDircInfo", false, instance.getIncludeDMDircInfo());
93
+        assertFalse("testDMDircInfo", instance.getIncludeDMDircInfo());
92 94
         instance.setIncludeDMDircInfo(true);
93
-        assertEquals("testDMDircInfo", true, instance.getIncludeDMDircInfo());
95
+        assertTrue("testDMDircInfo", instance.getIncludeDMDircInfo());
94 96
     }
95 97
 
96 98
     @Test

+ 1
- 1
test/com/dmdirc/ui/core/util/URLHandlerTest.java Dosyayı Görüntüle

@@ -33,7 +33,7 @@ import static org.junit.Assert.*;
33 33
 public class URLHandlerTest {
34 34
 
35 35
     @Test
36
-    public void testSubstituteParams() throws MalformedURLException, URISyntaxException {
36
+    public void testSubstituteParams() throws Exception {
37 37
         final Object[][] tests = new Object[][]{
38 38
             {new URI("protocol://host/path"), "$protocol $host $path", "protocol host /path"},
39 39
             {new URI("protocol://host"), "$protocol $host $path", "protocol host "},

Loading…
İptal
Kaydet