|
@@ -24,7 +24,7 @@ package com.dmdirc.addons.identd;
|
24
|
24
|
|
25
|
25
|
import com.dmdirc.Server;
|
26
|
26
|
import com.dmdirc.ServerManager;
|
27
|
|
-import com.dmdirc.config.ConfigManager;
|
|
27
|
+import com.dmdirc.interfaces.config.AggregateConfigProvider;
|
28
|
28
|
import com.dmdirc.parser.irc.IRCClientInfo;
|
29
|
29
|
import com.dmdirc.parser.irc.IRCParser;
|
30
|
30
|
|
|
@@ -32,19 +32,25 @@ import java.util.ArrayList;
|
32
|
32
|
import java.util.List;
|
33
|
33
|
|
34
|
34
|
import org.junit.Test;
|
|
35
|
+import org.junit.runner.RunWith;
|
|
36
|
+import org.mockito.Mock;
|
|
37
|
+import org.mockito.runners.MockitoJUnitRunner;
|
35
|
38
|
|
36
|
39
|
import static org.junit.Assert.*;
|
37
|
40
|
import static org.mockito.Mockito.*;
|
38
|
41
|
|
|
42
|
+@RunWith(MockitoJUnitRunner.class)
|
39
|
43
|
public class IdentClientTest {
|
40
|
44
|
|
|
45
|
+ @Mock private AggregateConfigProvider acp;
|
|
46
|
+ @Mock private IdentdPlugin plugin;
|
|
47
|
+ @Mock private ServerManager sm;
|
|
48
|
+ @Mock private Server server;
|
|
49
|
+ @Mock private IRCParser parser;
|
|
50
|
+ @Mock private IRCClientInfo client;
|
|
51
|
+
|
41
|
52
|
protected IdentClient getClient() {
|
42
|
|
- IdentdPlugin plugin = mock(IdentdPlugin.class);
|
43
|
|
- ServerManager sm = mock(ServerManager.class);
|
44
|
|
- Server server = mock(Server.class);
|
45
|
|
- IRCParser parser = mock(IRCParser.class);
|
46
|
|
- IRCClientInfo client = mock(IRCClientInfo.class);
|
47
|
|
- final List<Server> servers = new ArrayList<Server>();
|
|
53
|
+ final List<Server> servers = new ArrayList<>();
|
48
|
54
|
servers.add(server);
|
49
|
55
|
|
50
|
56
|
when(plugin.getDomain()).thenReturn("plugin-Identd");
|
|
@@ -60,8 +66,7 @@ public class IdentClientTest {
|
60
|
66
|
|
61
|
67
|
@Test
|
62
|
68
|
public void testInvalidIdent() {
|
63
|
|
- final ConfigManager cm = mock(ConfigManager.class);
|
64
|
|
- final String response = getClient().getIdentResponse("invalid request!", cm);
|
|
69
|
+ final String response = getClient().getIdentResponse("invalid request!", acp);
|
65
|
70
|
|
66
|
71
|
assertContains("Illegal requests must result in an ERROR response",
|
67
|
72
|
response, "ERROR");
|
|
@@ -69,8 +74,7 @@ public class IdentClientTest {
|
69
|
74
|
|
70
|
75
|
@Test
|
71
|
76
|
public void testQuoting() {
|
72
|
|
- final ConfigManager cm = mock(ConfigManager.class);
|
73
|
|
- final String response = getClient().getIdentResponse("in\\valid:invalid", cm);
|
|
77
|
+ final String response = getClient().getIdentResponse("in\\valid:invalid", acp);
|
74
|
78
|
|
75
|
79
|
assertStartsWith("Special chars in illegal requests must be quoted",
|
76
|
80
|
response, "in\\\\valid\\:invalid");
|
|
@@ -78,8 +82,7 @@ public class IdentClientTest {
|
78
|
82
|
|
79
|
83
|
@Test
|
80
|
84
|
public void testQuoting2() {
|
81
|
|
- final ConfigManager cm = mock(ConfigManager.class);
|
82
|
|
- final String response = getClient().getIdentResponse("in\\\\valid\\ inv\\:alid", cm);
|
|
85
|
+ final String response = getClient().getIdentResponse("in\\\\valid\\ inv\\:alid", acp);
|
83
|
86
|
|
84
|
87
|
assertStartsWith("Escaped characters in illegal requests shouldn't be doubly-escaped",
|
85
|
88
|
response, "in\\\\valid\\ inv\\:alid");
|
|
@@ -87,8 +90,7 @@ public class IdentClientTest {
|
87
|
90
|
|
88
|
91
|
@Test
|
89
|
92
|
public void testNonNumericPort() {
|
90
|
|
- final ConfigManager cm = mock(ConfigManager.class);
|
91
|
|
- final String response = getClient().getIdentResponse("abc, def", cm);
|
|
93
|
+ final String response = getClient().getIdentResponse("abc, def", acp);
|
92
|
94
|
|
93
|
95
|
assertContains("Non-numeric ports must result in an ERROR response",
|
94
|
96
|
response, "ERROR");
|
|
@@ -97,8 +99,7 @@ public class IdentClientTest {
|
97
|
99
|
}
|
98
|
100
|
|
99
|
101
|
private void doPortTest(final String ports) {
|
100
|
|
- final ConfigManager cm = mock(ConfigManager.class);
|
101
|
|
- final String response = getClient().getIdentResponse(ports, cm);
|
|
102
|
+ final String response = getClient().getIdentResponse(ports, acp);
|
102
|
103
|
|
103
|
104
|
assertContains("Illegal ports must result in an ERROR response",
|
104
|
105
|
response, "ERROR");
|
|
@@ -118,10 +119,9 @@ public class IdentClientTest {
|
118
|
119
|
|
119
|
120
|
@Test
|
120
|
121
|
public void testAlwaysOn() {
|
121
|
|
- final ConfigManager cm = mock(ConfigManager.class);
|
122
|
|
- when(cm.getOptionBool("plugin-Identd", "advanced.alwaysOn")).thenReturn(false);
|
|
122
|
+ when(acp.getOptionBool("plugin-Identd", "advanced.alwaysOn")).thenReturn(false);
|
123
|
123
|
|
124
|
|
- final String response = getClient().getIdentResponse("50, 50", cm);
|
|
124
|
+ final String response = getClient().getIdentResponse("50, 50", acp);
|
125
|
125
|
assertContains("Unknown port requests must return an ERROR response",
|
126
|
126
|
response, "ERROR");
|
127
|
127
|
assertContains("Unknown port requests must return a NO-USER response",
|
|
@@ -130,11 +130,10 @@ public class IdentClientTest {
|
130
|
130
|
|
131
|
131
|
@Test
|
132
|
132
|
public void testHidden() {
|
133
|
|
- final ConfigManager cm = mock(ConfigManager.class);
|
134
|
|
- when(cm.getOptionBool("plugin-Identd", "advanced.alwaysOn")).thenReturn(true);
|
135
|
|
- when(cm.getOptionBool("plugin-Identd", "advanced.isHiddenUser")).thenReturn(true);
|
|
133
|
+ when(acp.getOptionBool("plugin-Identd", "advanced.alwaysOn")).thenReturn(true);
|
|
134
|
+ when(acp.getOptionBool("plugin-Identd", "advanced.isHiddenUser")).thenReturn(true);
|
136
|
135
|
|
137
|
|
- final String response = getClient().getIdentResponse("50, 50", cm);
|
|
136
|
+ final String response = getClient().getIdentResponse("50, 50", acp);
|
138
|
137
|
assertContains("Hidden requests must return an ERROR response",
|
139
|
138
|
response, "ERROR");
|
140
|
139
|
assertContains("Hidden requests must return a HIDDEN-USER response",
|
|
@@ -143,45 +142,42 @@ public class IdentClientTest {
|
143
|
142
|
|
144
|
143
|
@Test
|
145
|
144
|
public void testSystemNameQuoting() {
|
146
|
|
- final ConfigManager cm = mock(ConfigManager.class);
|
147
|
|
- when(cm.getOptionBool("plugin-Identd", "advanced.alwaysOn")).thenReturn(true);
|
148
|
|
- when(cm.getOptionBool("plugin-Identd", "advanced.isHiddenUser")).thenReturn(false);
|
149
|
|
- when(cm.getOptionBool("plugin-Identd", "advanced.useCustomSystem")).thenReturn(true);
|
150
|
|
- when(cm.getOption("plugin-Identd", "advanced.customSystem")).thenReturn("a:b\\c,d");
|
151
|
|
- when(cm.getOptionBool("plugin-Identd", "general.useCustomName")).thenReturn(false);
|
152
|
|
- when(cm.getOption("plugin-Identd", "general.customName")).thenReturn("");
|
153
|
|
-
|
154
|
|
- final String response = getClient().getIdentResponse("50, 50", cm);
|
|
145
|
+ when(acp.getOptionBool("plugin-Identd", "advanced.alwaysOn")).thenReturn(true);
|
|
146
|
+ when(acp.getOptionBool("plugin-Identd", "advanced.isHiddenUser")).thenReturn(false);
|
|
147
|
+ when(acp.getOptionBool("plugin-Identd", "advanced.useCustomSystem")).thenReturn(true);
|
|
148
|
+ when(acp.getOption("plugin-Identd", "advanced.customSystem")).thenReturn("a:b\\c,d");
|
|
149
|
+ when(acp.getOptionBool("plugin-Identd", "general.useCustomName")).thenReturn(false);
|
|
150
|
+ when(acp.getOption("plugin-Identd", "general.customName")).thenReturn("");
|
|
151
|
+
|
|
152
|
+ final String response = getClient().getIdentResponse("50, 50", acp);
|
155
|
153
|
assertContains("Special characters must be quoted in system names",
|
156
|
154
|
response, "a\\:b\\\\c\\,d");
|
157
|
155
|
}
|
158
|
156
|
|
159
|
157
|
@Test
|
160
|
158
|
public void testCustomNameQuoting() {
|
161
|
|
- final ConfigManager cm = mock(ConfigManager.class);
|
162
|
|
- when(cm.getOptionBool("plugin-Identd", "advanced.alwaysOn")).thenReturn(true);
|
163
|
|
- when(cm.getOptionBool("plugin-Identd", "advanced.isHiddenUser")).thenReturn(false);
|
164
|
|
- when(cm.getOptionBool("plugin-Identd", "advanced.useCustomSystem")).thenReturn(false);
|
165
|
|
- when(cm.getOption("plugin-Identd", "advanced.customSystem")).thenReturn("");
|
166
|
|
- when(cm.getOptionBool("plugin-Identd", "general.useCustomName")).thenReturn(true);
|
167
|
|
- when(cm.getOption("plugin-Identd", "general.customName")).thenReturn("a:b\\c,d");
|
168
|
|
-
|
169
|
|
- final String response = getClient().getIdentResponse("50, 50", cm);
|
|
159
|
+ when(acp.getOptionBool("plugin-Identd", "advanced.alwaysOn")).thenReturn(true);
|
|
160
|
+ when(acp.getOptionBool("plugin-Identd", "advanced.isHiddenUser")).thenReturn(false);
|
|
161
|
+ when(acp.getOptionBool("plugin-Identd", "advanced.useCustomSystem")).thenReturn(false);
|
|
162
|
+ when(acp.getOption("plugin-Identd", "advanced.customSystem")).thenReturn("");
|
|
163
|
+ when(acp.getOptionBool("plugin-Identd", "general.useCustomName")).thenReturn(true);
|
|
164
|
+ when(acp.getOption("plugin-Identd", "general.customName")).thenReturn("a:b\\c,d");
|
|
165
|
+
|
|
166
|
+ final String response = getClient().getIdentResponse("50, 50", acp);
|
170
|
167
|
assertContains("Special characters must be quoted in custom names",
|
171
|
168
|
response, "a\\:b\\\\c\\,d");
|
172
|
169
|
}
|
173
|
170
|
|
174
|
171
|
@Test
|
175
|
172
|
public void testCustomNames() {
|
176
|
|
- final ConfigManager cm = mock(ConfigManager.class);
|
177
|
|
- when(cm.getOptionBool("plugin-Identd", "advanced.alwaysOn")).thenReturn(true);
|
178
|
|
- when(cm.getOptionBool("plugin-Identd", "advanced.isHiddenUser")).thenReturn(false);
|
179
|
|
- when(cm.getOptionBool("plugin-Identd", "advanced.useCustomSystem")).thenReturn(true);
|
180
|
|
- when(cm.getOption("plugin-Identd", "advanced.customSystem")).thenReturn("system");
|
181
|
|
- when(cm.getOptionBool("plugin-Identd", "general.useCustomName")).thenReturn(true);
|
182
|
|
- when(cm.getOption("plugin-Identd", "general.customName")).thenReturn("name");
|
183
|
|
-
|
184
|
|
- final String response = getClient().getIdentResponse("50, 60", cm);
|
|
173
|
+ when(acp.getOptionBool("plugin-Identd", "advanced.alwaysOn")).thenReturn(true);
|
|
174
|
+ when(acp.getOptionBool("plugin-Identd", "advanced.isHiddenUser")).thenReturn(false);
|
|
175
|
+ when(acp.getOptionBool("plugin-Identd", "advanced.useCustomSystem")).thenReturn(true);
|
|
176
|
+ when(acp.getOption("plugin-Identd", "advanced.customSystem")).thenReturn("system");
|
|
177
|
+ when(acp.getOptionBool("plugin-Identd", "general.useCustomName")).thenReturn(true);
|
|
178
|
+ when(acp.getOption("plugin-Identd", "general.customName")).thenReturn("name");
|
|
179
|
+
|
|
180
|
+ final String response = getClient().getIdentResponse("50, 60", acp);
|
185
|
181
|
final String[] bits = response.split(":");
|
186
|
182
|
|
187
|
183
|
assertTrue("Responses must include port pair",
|
|
@@ -194,144 +190,132 @@ public class IdentClientTest {
|
194
|
190
|
|
195
|
191
|
@Test
|
196
|
192
|
public void testOSWindows() {
|
197
|
|
- final ConfigManager cm = mock(ConfigManager.class);
|
198
|
|
- when(cm.getOptionBool("plugin-Identd", "advanced.alwaysOn")).thenReturn(true);
|
199
|
|
- when(cm.getOptionBool("plugin-Identd", "advanced.useCustomSystem")).thenReturn(false);
|
|
193
|
+ when(acp.getOptionBool("plugin-Identd", "advanced.alwaysOn")).thenReturn(true);
|
|
194
|
+ when(acp.getOptionBool("plugin-Identd", "advanced.useCustomSystem")).thenReturn(false);
|
200
|
195
|
System.setProperty("user.name", "test");
|
201
|
196
|
System.setProperty("os.name", "windows");
|
202
|
197
|
|
203
|
|
- final String response = getClient().getIdentResponse("50, 50", cm);
|
|
198
|
+ final String response = getClient().getIdentResponse("50, 50", acp);
|
204
|
199
|
assertEquals("50 , 50 : USERID : WIN32 : test", response);
|
205
|
200
|
}
|
206
|
201
|
|
207
|
202
|
@Test
|
208
|
203
|
public void testOSMac() {
|
209
|
|
- final ConfigManager cm = mock(ConfigManager.class);
|
210
|
|
- when(cm.getOptionBool("plugin-Identd", "advanced.alwaysOn")).thenReturn(true);
|
211
|
|
- when(cm.getOptionBool("plugin-Identd", "advanced.useCustomSystem")).thenReturn(false);
|
|
204
|
+ when(acp.getOptionBool("plugin-Identd", "advanced.alwaysOn")).thenReturn(true);
|
|
205
|
+ when(acp.getOptionBool("plugin-Identd", "advanced.useCustomSystem")).thenReturn(false);
|
212
|
206
|
System.setProperty("user.name", "test");
|
213
|
207
|
System.setProperty("os.name", "mac");
|
214
|
208
|
|
215
|
|
- final String response = getClient().getIdentResponse("50, 50", cm);
|
|
209
|
+ final String response = getClient().getIdentResponse("50, 50", acp);
|
216
|
210
|
assertEquals("50 , 50 : USERID : MACOS : test", response);
|
217
|
211
|
}
|
218
|
212
|
|
219
|
213
|
@Test
|
220
|
214
|
public void testOSLinux() {
|
221
|
|
- final ConfigManager cm = mock(ConfigManager.class);
|
222
|
|
- when(cm.getOptionBool("plugin-Identd", "advanced.alwaysOn")).thenReturn(true);
|
223
|
|
- when(cm.getOptionBool("plugin-Identd", "advanced.useCustomSystem")).thenReturn(false);
|
|
215
|
+ when(acp.getOptionBool("plugin-Identd", "advanced.alwaysOn")).thenReturn(true);
|
|
216
|
+ when(acp.getOptionBool("plugin-Identd", "advanced.useCustomSystem")).thenReturn(false);
|
224
|
217
|
System.setProperty("user.name", "test");
|
225
|
218
|
System.setProperty("os.name", "linux");
|
226
|
219
|
|
227
|
|
- final String response = getClient().getIdentResponse("50, 50", cm);
|
|
220
|
+ final String response = getClient().getIdentResponse("50, 50", acp);
|
228
|
221
|
assertEquals("50 , 50 : USERID : UNIX : test", response);
|
229
|
222
|
}
|
230
|
223
|
|
231
|
224
|
@Test
|
232
|
225
|
public void testOSBSD() {
|
233
|
|
- final ConfigManager cm = mock(ConfigManager.class);
|
234
|
|
- when(cm.getOptionBool("plugin-Identd", "advanced.alwaysOn")).thenReturn(true);
|
235
|
|
- when(cm.getOptionBool("plugin-Identd", "advanced.useCustomSystem")).thenReturn(false);
|
|
226
|
+ when(acp.getOptionBool("plugin-Identd", "advanced.alwaysOn")).thenReturn(true);
|
|
227
|
+ when(acp.getOptionBool("plugin-Identd", "advanced.useCustomSystem")).thenReturn(false);
|
236
|
228
|
System.setProperty("user.name", "test");
|
237
|
229
|
System.setProperty("os.name", "bsd");
|
238
|
230
|
|
239
|
|
- final String response = getClient().getIdentResponse("50, 50", cm);
|
|
231
|
+ final String response = getClient().getIdentResponse("50, 50", acp);
|
240
|
232
|
assertEquals("50 , 50 : USERID : UNIX-BSD : test", response);
|
241
|
233
|
}
|
242
|
234
|
|
243
|
235
|
@Test
|
244
|
236
|
public void testOSOS2() {
|
245
|
|
- final ConfigManager cm = mock(ConfigManager.class);
|
246
|
|
- when(cm.getOptionBool("plugin-Identd", "advanced.alwaysOn")).thenReturn(true);
|
247
|
|
- when(cm.getOptionBool("plugin-Identd", "advanced.useCustomSystem")).thenReturn(false);
|
|
237
|
+ when(acp.getOptionBool("plugin-Identd", "advanced.alwaysOn")).thenReturn(true);
|
|
238
|
+ when(acp.getOptionBool("plugin-Identd", "advanced.useCustomSystem")).thenReturn(false);
|
248
|
239
|
System.setProperty("user.name", "test");
|
249
|
240
|
System.setProperty("os.name", "os/2");
|
250
|
241
|
|
251
|
|
- final String response = getClient().getIdentResponse("50, 50", cm);
|
|
242
|
+ final String response = getClient().getIdentResponse("50, 50", acp);
|
252
|
243
|
assertEquals("50 , 50 : USERID : OS/2 : test", response);
|
253
|
244
|
}
|
254
|
245
|
|
255
|
246
|
@Test
|
256
|
247
|
public void testOSUnix() {
|
257
|
|
- final ConfigManager cm = mock(ConfigManager.class);
|
258
|
|
- when(cm.getOptionBool("plugin-Identd", "advanced.alwaysOn")).thenReturn(true);
|
259
|
|
- when(cm.getOptionBool("plugin-Identd", "advanced.useCustomSystem")).thenReturn(false);
|
|
248
|
+ when(acp.getOptionBool("plugin-Identd", "advanced.alwaysOn")).thenReturn(true);
|
|
249
|
+ when(acp.getOptionBool("plugin-Identd", "advanced.useCustomSystem")).thenReturn(false);
|
260
|
250
|
System.setProperty("user.name", "test");
|
261
|
251
|
System.setProperty("os.name", "unix");
|
262
|
252
|
|
263
|
|
- final String response = getClient().getIdentResponse("50, 50", cm);
|
|
253
|
+ final String response = getClient().getIdentResponse("50, 50", acp);
|
264
|
254
|
assertEquals("50 , 50 : USERID : UNIX : test", response);
|
265
|
255
|
}
|
266
|
256
|
|
267
|
257
|
@Test
|
268
|
258
|
public void testOSIrix() {
|
269
|
|
- final ConfigManager cm = mock(ConfigManager.class);
|
270
|
|
- when(cm.getOptionBool("plugin-Identd", "advanced.alwaysOn")).thenReturn(true);
|
271
|
|
- when(cm.getOptionBool("plugin-Identd", "advanced.useCustomSystem")).thenReturn(false);
|
|
259
|
+ when(acp.getOptionBool("plugin-Identd", "advanced.alwaysOn")).thenReturn(true);
|
|
260
|
+ when(acp.getOptionBool("plugin-Identd", "advanced.useCustomSystem")).thenReturn(false);
|
272
|
261
|
System.setProperty("user.name", "test");
|
273
|
262
|
System.setProperty("os.name", "irix");
|
274
|
263
|
|
275
|
|
- final String response = getClient().getIdentResponse("50, 50", cm);
|
|
264
|
+ final String response = getClient().getIdentResponse("50, 50", acp);
|
276
|
265
|
assertEquals("50 , 50 : USERID : IRIX : test", response);
|
277
|
266
|
}
|
278
|
267
|
|
279
|
268
|
@Test
|
280
|
269
|
public void testOSUnknown() {
|
281
|
|
- final ConfigManager cm = mock(ConfigManager.class);
|
282
|
|
- when(cm.getOptionBool("plugin-Identd", "advanced.alwaysOn")).thenReturn(true);
|
283
|
|
- when(cm.getOptionBool("plugin-Identd", "advanced.useCustomSystem")).thenReturn(false);
|
|
270
|
+ when(acp.getOptionBool("plugin-Identd", "advanced.alwaysOn")).thenReturn(true);
|
|
271
|
+ when(acp.getOptionBool("plugin-Identd", "advanced.useCustomSystem")).thenReturn(false);
|
284
|
272
|
System.setProperty("user.name", "test");
|
285
|
273
|
System.setProperty("os.name", "test");
|
286
|
274
|
|
287
|
|
- final String response = getClient().getIdentResponse("50, 50", cm);
|
|
275
|
+ final String response = getClient().getIdentResponse("50, 50", acp);
|
288
|
276
|
assertEquals("50 , 50 : USERID : UNKNOWN : test", response);
|
289
|
277
|
}
|
290
|
278
|
|
291
|
279
|
@Test
|
292
|
280
|
public void testNameSystem() {
|
293
|
|
- final ConfigManager cm = mock(ConfigManager.class);
|
294
|
|
- when(cm.getOptionBool("plugin-Identd", "advanced.alwaysOn")).thenReturn(true);
|
295
|
|
- when(cm.getOptionBool("plugin-Identd", "advanced.useCustomSystem")).thenReturn(false);
|
|
281
|
+ when(acp.getOptionBool("plugin-Identd", "advanced.alwaysOn")).thenReturn(true);
|
|
282
|
+ when(acp.getOptionBool("plugin-Identd", "advanced.useCustomSystem")).thenReturn(false);
|
296
|
283
|
System.setProperty("user.name", "test");
|
297
|
284
|
System.setProperty("os.name", "test");
|
298
|
285
|
|
299
|
|
- final String response = getClient().getIdentResponse("50, 50", cm);
|
|
286
|
+ final String response = getClient().getIdentResponse("50, 50", acp);
|
300
|
287
|
assertEquals("50 , 50 : USERID : UNKNOWN : test", response);
|
301
|
288
|
}
|
302
|
289
|
|
303
|
290
|
@Test
|
304
|
291
|
public void testNameCustom() {
|
305
|
|
- final ConfigManager cm = mock(ConfigManager.class);
|
306
|
|
- when(cm.getOptionBool("plugin-Identd", "advanced.alwaysOn")).thenReturn(true);
|
307
|
|
- when(cm.getOptionBool("plugin-Identd", "general.useCustomName")).thenReturn(true);
|
308
|
|
- when(cm.getOption("plugin-Identd", "general.customName")).thenReturn("name");
|
|
292
|
+ when(acp.getOptionBool("plugin-Identd", "advanced.alwaysOn")).thenReturn(true);
|
|
293
|
+ when(acp.getOptionBool("plugin-Identd", "general.useCustomName")).thenReturn(true);
|
|
294
|
+ when(acp.getOption("plugin-Identd", "general.customName")).thenReturn("name");
|
309
|
295
|
System.setProperty("user.name", "test");
|
310
|
296
|
System.setProperty("os.name", "test");
|
311
|
297
|
|
312
|
|
- final String response = getClient().getIdentResponse("50, 50", cm);
|
|
298
|
+ final String response = getClient().getIdentResponse("50, 50", acp);
|
313
|
299
|
assertEquals("50 , 50 : USERID : UNKNOWN : name", response);
|
314
|
300
|
}
|
315
|
301
|
|
316
|
302
|
@Test
|
317
|
303
|
public void testNameNickname() {
|
318
|
|
- final ConfigManager cm = mock(ConfigManager.class);
|
319
|
|
- when(cm.getOptionBool("plugin-Identd", "general.useNickname")).thenReturn(true);
|
|
304
|
+ when(acp.getOptionBool("plugin-Identd", "general.useNickname")).thenReturn(true);
|
320
|
305
|
System.setProperty("user.name", "test");
|
321
|
306
|
System.setProperty("os.name", "test");
|
322
|
307
|
|
323
|
|
- final String response = getClient().getIdentResponse("60, 50", cm);
|
|
308
|
+ final String response = getClient().getIdentResponse("60, 50", acp);
|
324
|
309
|
assertEquals("60 , 50 : USERID : UNKNOWN : nickname", response);
|
325
|
310
|
}
|
326
|
311
|
|
327
|
312
|
@Test
|
328
|
313
|
public void testNameUsername() {
|
329
|
|
- final ConfigManager cm = mock(ConfigManager.class);
|
330
|
|
- when(cm.getOptionBool("plugin-Identd", "general.useUsername")).thenReturn(true);
|
|
314
|
+ when(acp.getOptionBool("plugin-Identd", "general.useUsername")).thenReturn(true);
|
331
|
315
|
System.setProperty("user.name", "test");
|
332
|
316
|
System.setProperty("os.name", "test");
|
333
|
317
|
|
334
|
|
- final String response = getClient().getIdentResponse("60, 50", cm);
|
|
318
|
+ final String response = getClient().getIdentResponse("60, 50", acp);
|
335
|
319
|
assertEquals("60 , 50 : USERID : UNKNOWN : username", response);
|
336
|
320
|
}
|
337
|
321
|
|