+20
-24
lines changedFilter options
+20
-24
lines changed Original file line number Diff line number Diff line change
@@ -52,12 +52,12 @@ public DefaultRemoteCommand(String command, String[] args) {
52
52
53
53
@Override
54
54
public String getCommandURLString() {
55
-
StringBuffer sb = new StringBuffer("cmd=");
55
+
StringBuilder sb = new StringBuilder("cmd=");
56
56
sb.append(Urls.urlEncode(command));
57
57
if (args == null) return sb.toString();
58
58
for (int i = 0; i < args.length; i++) {
59
59
sb.append('&');
60
-
sb.append(Integer.toString(i + 1));
60
+
sb.append(i + 1);
61
61
sb.append('=');
62
62
sb.append(Urls.urlEncode(args[i]));
63
63
}
Original file line number Diff line number Diff line change
@@ -46,8 +46,8 @@
46
46
public class HttpCommandProcessor implements CommandProcessor {
47
47
48
48
private String pathToServlet;
49
-
private String browserStartCommand;
50
-
private String browserURL;
49
+
private final String browserStartCommand;
50
+
private final String browserURL;
51
51
private String sessionId;
52
52
private String extensionJs;
53
53
private String rcServerLocation;
@@ -65,8 +65,7 @@ public class HttpCommandProcessor implements CommandProcessor {
65
65
*/
66
66
public HttpCommandProcessor(String serverHost, int serverPort, String browserStartCommand,
67
67
String browserURL) {
68
-
rcServerLocation = serverHost +
69
-
":" + Integer.toString(serverPort);
68
+
rcServerLocation = serverHost + ":" + serverPort;
70
69
this.pathToServlet = "http://" + rcServerLocation + "/selenium-server/driver/";
71
70
this.browserStartCommand = browserStartCommand;
72
71
this.browserURL = browserURL;
@@ -131,7 +130,7 @@ public String executeCommandOnServlet(String command) {
131
130
}
132
131
133
132
private String stringContentsOfInputStream(Reader rdr) throws IOException {
134
-
StringBuffer sb = new StringBuffer();
133
+
StringBuilder sb = new StringBuilder();
135
134
int c;
136
135
try {
137
136
while ((c = rdr.read()) != -1) {
@@ -219,7 +218,7 @@ protected void closeResources(HttpURLConnection conn, Writer wr, Reader rdr) {
219
218
}
220
219
221
220
private String buildCommandBody(String command) {
222
-
StringBuffer sb = new StringBuffer();
221
+
StringBuilder sb = new StringBuilder();
223
222
sb.append(command);
224
223
if (sessionId != null) {
225
224
sb.append("&sessionId=");
@@ -307,13 +306,13 @@ public String[] getStringArray(String commandName, String[] args) {
307
306
*/
308
307
public static String[] parseCSV(String input) {
309
308
List<String> output = new ArrayList<>();
310
-
StringBuffer sb = new StringBuffer();
309
+
StringBuilder sb = new StringBuilder();
311
310
for (int i = 0; i < input.length(); i++) {
312
311
char c = input.charAt(i);
313
312
switch (c) {
314
313
case ',':
315
314
output.add(sb.toString());
316
-
sb = new StringBuffer();
315
+
sb = new StringBuilder();
317
316
continue;
318
317
case '\\':
319
318
i++;
@@ -324,7 +323,7 @@ public static String[] parseCSV(String input) {
324
323
}
325
324
}
326
325
output.add(sb.toString());
327
-
return output.toArray(new String[output.size()]);
326
+
return output.toArray(new String[0]);
328
327
}
329
328
330
329
@Override
@@ -338,7 +337,7 @@ public Number getNumber(String commandName, String[] args) {
338
337
}
339
338
if (n instanceof Long && n.intValue() == n.longValue()) {
340
339
// SRC-315 we should return Integers if possible
341
-
return Integer.valueOf(n.intValue());
340
+
return n.intValue();
342
341
}
343
342
return n;
344
343
}
Original file line number Diff line number Diff line change
@@ -49,7 +49,7 @@ public class SeleneseTestBase {
49
49
/** Use this object to run all of your selenium tests */
50
50
protected Selenium selenium;
51
51
52
-
protected StringBuffer verificationErrors = new StringBuffer();
52
+
protected StringBuilder verificationErrors = new StringBuilder();
53
53
54
54
public SeleneseTestBase() {
55
55
super();
@@ -184,7 +184,7 @@ public void verifyEquals(Object expected, Object actual) {
184
184
*/
185
185
public void verifyEquals(boolean expected, boolean actual) {
186
186
try {
187
-
assertEquals(Boolean.valueOf(expected), Boolean.valueOf(actual));
187
+
assertEquals(expected, actual);
188
188
} catch (Error e) {
189
189
verificationErrors.append(throwableToString(e));
190
190
}
@@ -346,10 +346,7 @@ public void verifyEquals(String[] expected, String[] actual) {
346
346
}
347
347
348
348
private static String verifyEqualsAndReturnComparisonDumpIfNot(String[] expected, String[] actual) {
349
-
boolean misMatch = false;
350
-
if (expected.length != actual.length) {
351
-
misMatch = true;
352
-
}
349
+
boolean misMatch = expected.length != actual.length;
353
350
for (int j = 0; j < expected.length; j++) {
354
351
if (!seleniumEquals(expected[j], actual[j])) {
355
352
misMatch = true;
@@ -364,9 +361,9 @@ private static String verifyEqualsAndReturnComparisonDumpIfNot(String[] expected
364
361
}
365
362
366
363
private static String stringArrayToString(String[] sa) {
367
-
StringBuffer sb = new StringBuffer("{");
368
-
for (int j = 0; j < sa.length; j++) {
369
-
sb.append(" ").append("\"").append(sa[j]).append("\"");
364
+
StringBuilder sb = new StringBuilder("{");
365
+
for (String s : sa) {
366
+
sb.append(" ").append("\"").append(s).append("\"");
370
367
}
371
368
sb.append(" }");
372
369
return sb.toString();
@@ -380,7 +377,7 @@ private static String throwableToString(Throwable t) {
380
377
}
381
378
382
379
public static String join(String[] sa, char c) {
383
-
StringBuffer sb = new StringBuffer();
380
+
StringBuilder sb = new StringBuilder();
384
381
for (int j = 0; j < sa.length; j++) {
385
382
sb.append(sa[j]);
386
383
if (j < sa.length - 1) {
@@ -477,7 +474,7 @@ public void checkForVerificationErrors() {
477
474
478
475
/** Clears out the list of verification errors */
479
476
public void clearVerificationErrors() {
480
-
verificationErrors = new StringBuffer();
477
+
verificationErrors = new StringBuilder();
481
478
}
482
479
483
480
/** checks for verification errors and stops the browser
Original file line number Diff line number Diff line change
@@ -47,7 +47,7 @@ public class EventFiringDecoratorTest {
47
47
48
48
static class CollectorListener implements WebDriverListener {
49
49
50
-
StringBuffer acc = new StringBuffer();
50
+
protected final StringBuilder acc = new StringBuilder();
51
51
52
52
@Override
53
53
public void beforeAnyCall(Object target, Method method, Object[] args) {
You can’t perform that action at this time.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4