瀏覽代碼

Style fixes

Change-Id: Ifbff0f1a0d193403613a0d444443dd1c45d1acc2
Reviewed-on: http://gerrit.dmdirc.com/1334
Automatic-Compile: DMDirc Local Commits <dmdirc@googlemail.com>
Reviewed-by: Gregory Holmes <greg@dmdirc.com>
tags/0.6.4^0
Chris Smith 14 年之前
父節點
當前提交
0378573a34
共有 2 個檔案被更改,包括 47 行新增47 行删除
  1. 30
    30
      test/com/dmdirc/util/ConfigFileTest.java
  2. 17
    17
      test/com/dmdirc/util/MapListTest.java

+ 30
- 30
test/com/dmdirc/util/ConfigFileTest.java 查看文件

@@ -33,13 +33,13 @@ import org.junit.Test;
33 33
 import static org.junit.Assert.*;
34 34
 
35 35
 public class ConfigFileTest {
36
-    
36
+
37 37
     private ConfigFile cf;
38
-    
38
+
39 39
     @Before
40 40
     public void setUp() throws Exception {
41 41
         cf = new ConfigFile(getClass().getResourceAsStream("test2.txt"));
42
-    }    
42
+    }
43 43
 
44 44
     @Test
45 45
     public void testRead() throws IOException, InvalidConfigFileException {
@@ -50,7 +50,7 @@ public class ConfigFileTest {
50 50
     public void testWrite() throws IOException {
51 51
         cf.write();
52 52
     }
53
-    
53
+
54 54
     @Test
55 55
     public void testDomains() throws IOException, InvalidConfigFileException {
56 56
         cf.read();
@@ -60,7 +60,7 @@ public class ConfigFileTest {
60 60
         assertTrue(cf.hasDomain("section one"));
61 61
         assertFalse(cf.hasDomain("random domain"));
62 62
     }
63
-    
63
+
64 64
     @Test
65 65
     public void testKeyDomains() throws IOException, InvalidConfigFileException {
66 66
         cf.read();
@@ -68,7 +68,7 @@ public class ConfigFileTest {
68 68
         assertFalse(cf.isKeyDomain("section one point one"));
69 69
         assertFalse(cf.isKeyDomain("section two"));
70 70
     }
71
-    
71
+
72 72
     @Test
73 73
     public void testFlatDomains() throws IOException, InvalidConfigFileException {
74 74
         cf.read();
@@ -76,9 +76,9 @@ public class ConfigFileTest {
76 76
         assertTrue(cf.isFlatDomain("section alpha"));
77 77
         assertTrue(cf.isFlatDomain("section one point one"));
78 78
         assertFalse(cf.isFlatDomain("section one"));
79
-        assertFalse(cf.hasDomain("random domain"));        
79
+        assertFalse(cf.hasDomain("random domain"));
80 80
     }
81
-    
81
+
82 82
     @Test
83 83
     public void testFlatDomainContents() throws IOException, InvalidConfigFileException {
84 84
         cf.read();
@@ -86,7 +86,7 @@ public class ConfigFileTest {
86 86
         assertEquals("line 1", cf.getFlatDomain("section alpha").get(0));
87 87
         assertEquals("line 2", cf.getFlatDomain("section alpha").get(1));
88 88
     }
89
-    
89
+
90 90
     @Test
91 91
     public void testKeyDomainContents() throws IOException, InvalidConfigFileException {
92 92
         cf.read();
@@ -95,7 +95,7 @@ public class ConfigFileTest {
95 95
         assertEquals("two", cf.getKeyDomain("section one").get("2"));
96 96
         assertEquals("three", cf.getKeyDomain("section one").get("3"));
97 97
     }
98
-    
98
+
99 99
     @Test
100 100
     public void testColons() throws IOException, InvalidConfigFileException {
101 101
         final File file = File.createTempFile("DMDirc.unittest", null);
@@ -106,17 +106,17 @@ public class ConfigFileTest {
106 106
         data.put("test3", "hello:");
107 107
         config.addDomain("test", data);
108 108
         config.write();
109
-        
109
+
110 110
         config = new ConfigFile(file);
111 111
         config.read();
112
-        
112
+
113 113
         assertTrue(config.isKeyDomain("test"));
114 114
         data = config.getKeyDomain("test");
115 115
         assertEquals("hello", data.get("test1"));
116 116
         assertEquals("hello", data.get("test:2"));
117 117
         assertEquals("hello:", data.get("test3"));
118 118
     }
119
-    
119
+
120 120
     @Test
121 121
     public void testEquals() throws IOException, InvalidConfigFileException {
122 122
         final File file = File.createTempFile("DMDirc.unittest", null);
@@ -127,17 +127,17 @@ public class ConfigFileTest {
127 127
         data.put("test3", "hello=");
128 128
         config.addDomain("test", data);
129 129
         config.write();
130
-        
130
+
131 131
         config = new ConfigFile(file);
132 132
         config.read();
133
-        
133
+
134 134
         assertTrue(config.isKeyDomain("test"));
135 135
         data = config.getKeyDomain("test");
136 136
         assertEquals("hello", data.get("test1"));
137 137
         assertEquals("hello", data.get("test=2"));
138 138
         assertEquals("hello=", data.get("test3"));
139 139
     }
140
-    
140
+
141 141
     @Test
142 142
     public void testNewlines() throws IOException, InvalidConfigFileException {
143 143
         final File file = File.createTempFile("DMDirc.unittest", null);
@@ -149,10 +149,10 @@ public class ConfigFileTest {
149 149
         data.put("test4", "hello\r\ngoodbye");
150 150
         config.addDomain("test", data);
151 151
         config.write();
152
-        
152
+
153 153
         config = new ConfigFile(file);
154 154
         config.read();
155
-        
155
+
156 156
         assertTrue(config.isKeyDomain("test"));
157 157
         data = config.getKeyDomain("test");
158 158
         assertEquals("hello", data.get("test1"));
@@ -160,7 +160,7 @@ public class ConfigFileTest {
160 160
         assertEquals("hello\n", data.get("test3"));
161 161
         assertEquals("hello\r\ngoodbye", data.get("test4"));
162 162
     }
163
-    
163
+
164 164
     @Test
165 165
     public void testBackslash() throws IOException, InvalidConfigFileException {
166 166
         final File file = File.createTempFile("DMDirc.unittest", null);
@@ -171,17 +171,17 @@ public class ConfigFileTest {
171 171
         data.put("test3\\", "hello");
172 172
         config.addDomain("test", data);
173 173
         config.write();
174
-        
174
+
175 175
         config = new ConfigFile(file);
176 176
         config.read();
177
-        
177
+
178 178
         assertTrue(config.isKeyDomain("test"));
179 179
         data = config.getKeyDomain("test");
180 180
         assertEquals("hello\\", data.get("test1"));
181 181
         assertEquals("\\nhello", data.get("test2"));
182 182
         assertEquals("hello", data.get("test3\\"));
183 183
     }
184
-    
184
+
185 185
     @Test
186 186
     public void testHash() throws IOException, InvalidConfigFileException {
187 187
         final File file = File.createTempFile("DMDirc.unittest", null);
@@ -192,30 +192,30 @@ public class ConfigFileTest {
192 192
         data.put("test3", "#hello");
193 193
         config.addDomain("test", data);
194 194
         config.write();
195
-        
195
+
196 196
         config = new ConfigFile(file);
197 197
         config.read();
198
-        
198
+
199 199
         assertTrue(config.isKeyDomain("test"));
200 200
         data = config.getKeyDomain("test");
201 201
         assertEquals("hello", data.get("test1#"));
202 202
         assertEquals("hello", data.get("#test2"));
203 203
         assertEquals("#hello", data.get("test3"));
204
-    }    
205
-    
204
+    }
205
+
206 206
     @Test
207 207
     public void testEscape() {
208 208
         final String input = "blah blah\\foo\r\nbar=:";
209 209
         final String output = "blah blah\\\\foo\\r\\nbar\\=\\:";
210 210
         assertEquals(output, ConfigFile.escape(input));
211 211
     }
212
-    
212
+
213 213
     @Test
214 214
     public void testUnescape() {
215 215
         final String input = "blah blah\\foo\r\nbar=:";
216 216
         assertEquals(input, ConfigFile.unescape(ConfigFile.escape(input)));
217 217
     }
218
-    
218
+
219 219
     @Test
220 220
     public void testDelete() throws IOException {
221 221
         final File file = File.createTempFile("DMDirc_unittest", null);
@@ -225,12 +225,12 @@ public class ConfigFileTest {
225 225
         config.delete();
226 226
         assertFalse(file.exists());
227 227
     }
228
-    
228
+
229 229
     @Test
230 230
     public void testDuplicateKeys() throws IOException, InvalidConfigFileException {
231 231
         final ConfigFile file = new ConfigFile(getClass().getResourceAsStream("test2.txt"));
232 232
         file.read();
233
-        
233
+
234 234
         assertTrue(file.isKeyDomain("section one"));
235 235
         assertEquals(3, file.getKeyDomain("section one").size());
236 236
         assertTrue(file.isFlatDomain("section one point one"));

+ 17
- 17
test/com/dmdirc/util/MapListTest.java 查看文件

@@ -39,7 +39,7 @@ public class MapListTest {
39 39
         test.removeFromAll("b");
40 40
         assertTrue(test.isEmpty());
41 41
     }
42
-    
42
+
43 43
     @Test
44 44
     public void testAddCollection() {
45 45
         final MapList<String, String> test = new MapList<String, String>();
@@ -47,12 +47,12 @@ public class MapListTest {
47 47
         testList.add("d");
48 48
         testList.add("e");
49 49
         test.add("key", testList);
50
-        
50
+
51 51
         assertTrue(test.containsKey("key"));
52 52
         assertTrue(test.containsValue("key", "d"));
53 53
         assertTrue(test.containsValue("key", "e"));
54 54
     }
55
-    
55
+
56 56
     @Test
57 57
     public void testClear() {
58 58
         final MapList<String, String> test = new MapList<String, String>();
@@ -61,7 +61,7 @@ public class MapListTest {
61 61
         test.clear();
62 62
         assertTrue(test.isEmpty());
63 63
     }
64
-    
64
+
65 65
     @Test
66 66
     public void testClearKey() {
67 67
         final MapList<String, String> test = new MapList<String, String>();
@@ -71,24 +71,24 @@ public class MapListTest {
71 71
         assertTrue(test.values("a").isEmpty());
72 72
         assertFalse(test.isEmpty());
73 73
     }
74
-    
74
+
75 75
     @Test
76 76
     public void testRemove() {
77 77
         final MapList<String, String> test = new MapList<String, String>();
78 78
         test.add("a", "b");
79 79
         test.add("d", "e");
80 80
         test.remove("z", "b");
81
-        
81
+
82 82
         assertEquals(2, test.keySet().size());
83 83
         assertEquals(1, test.values("a").size());
84 84
         assertEquals(1, test.values("d").size());
85
-        
85
+
86 86
         test.remove("a", "b");
87 87
         assertEquals(2, test.keySet().size());
88 88
         assertEquals(0, test.values("a").size());
89
-        assertEquals(1, test.values("d").size());        
90
-    }    
91
-    
89
+        assertEquals(1, test.values("d").size());
90
+    }
91
+
92 92
     @Test
93 93
     public void testKeySet() {
94 94
         final MapList<String, String> test = new MapList<String, String>();
@@ -97,7 +97,7 @@ public class MapListTest {
97 97
         assertEquals(2, test.keySet().size());
98 98
         assertTrue(test.keySet().contains("a"));
99 99
         assertTrue(test.keySet().contains("d"));
100
-    }    
100
+    }
101 101
 
102 102
     @Test
103 103
     public void testContainsKey() {
@@ -121,26 +121,26 @@ public class MapListTest {
121 121
         assertEquals("b", test.get("a").get(0));
122 122
         assertEquals("b", test.get("a", 0));
123 123
     }
124
-    
124
+
125 125
     @Test
126 126
     public void testInherit() {
127 127
         final MapList<String, String> test1 = new MapList<String, String>();
128 128
         test1.add("a", "b");
129
-        
129
+
130 130
         final MapList<String, String> test2 = new MapList<String, String>(test1);
131 131
         assertEquals(1, test2.get("a").size());
132 132
         assertEquals("b", test2.get("a").get(0));
133
-        assertEquals("b", test2.get("a", 0));        
133
+        assertEquals("b", test2.get("a", 0));
134 134
     }
135
-    
135
+
136 136
     @Test
137 137
     public void testGetMap() {
138 138
         final MapList<String, String> test1 = new MapList<String, String>();
139 139
         test1.add("a", "b");
140 140
         assertNotSame(test1.getMap(), test1.getMap());
141
-        
141
+
142 142
         final MapList<String, String> test2 = new MapList<String, String>(test1);
143 143
         assertEquals(test1.getMap(), test2.getMap());
144
-    }    
144
+    }
145 145
 
146 146
 }

Loading…
取消
儲存