Skip to content

Commit c0e813f

Browse files
committed
checkstyle
1 parent 75432e2 commit c0e813f

7 files changed

Lines changed: 49 additions & 49 deletions

File tree

src/test/java/org/htmlunit/general/HostConstructorTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
@Ignore("Work in progress")
4242
public class HostConstructorTest extends WebDriverTestCase {
4343

44-
private static final HashSet<String> passing = new HashSet<>(Arrays.asList(
44+
private static final HashSet<String> PASSING = new HashSet<>(Arrays.asList(
4545
"Animation",
4646
"Blob",
4747
"DOMParser",
@@ -102,7 +102,7 @@ private void test(final String className) throws Exception {
102102
}
103103

104104
private String getExpectedString(final String className) throws Exception {
105-
if (passing.contains(className)) {
105+
if (PASSING.contains(className)) {
106106
return "[object " + className_ + "]";
107107
}
108108

src/test/java/org/htmlunit/html/HtmlImageDownloadTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,14 +44,14 @@
4444
*/
4545
@RunWith(BrowserRunner.class)
4646
public class HtmlImageDownloadTest extends WebServerTestCase {
47-
private static final String base_file_path_ = "src/test/resources/org/htmlunit/html";
47+
private static final String BASE_FILE_PATH = "src/test/resources/org/htmlunit/html";
4848

4949
/**
5050
* Constructor.
5151
* @throws Exception if an exception occurs
5252
*/
5353
public HtmlImageDownloadTest() throws Exception {
54-
startWebServer(base_file_path_);
54+
startWebServer(BASE_FILE_PATH);
5555
}
5656

5757
/**

src/test/java/org/htmlunit/javascript/host/dom/TreeWalkerTest.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
*/
3030
@RunWith(BrowserRunner.class)
3131
public class TreeWalkerTest extends WebDriverTestCase {
32-
private static final String contentStart = "<html><head><title></title>\n"
32+
private static final String CONTENT_START = "<html><head><title></title>\n"
3333
+ "<script>\n"
3434
+ LOG_TITLE_FUNCTION
3535
+ "function safeTagName(o) {\n"
@@ -44,7 +44,7 @@ public class TreeWalkerTest extends WebDriverTestCase {
4444
+ "function test() {\n"
4545
+ " try {\n";
4646

47-
private static final String contentEnd = "\n } catch(e) { log('exception') }\n"
47+
private static final String CONTENT_END = "\n } catch(e) { log('exception') }\n"
4848
+ "\n}\n</script></head>\n"
4949
+ "<body onload='test()'>\n"
5050
+ "<div id='theDiv'>Hello, <span id='theSpan'>this is a test for"
@@ -54,12 +54,12 @@ public class TreeWalkerTest extends WebDriverTestCase {
5454
+ "</body></html>";
5555

5656
private void test(final String script) throws Exception {
57-
final String html = contentStart + script + contentEnd;
57+
final String html = CONTENT_START + script + CONTENT_END;
5858

5959
loadPageVerifyTitle2(html);
6060
}
6161

62-
private static final String contentStart2 = "<html><head><title></title>\n"
62+
private static final String CONTENT_START2 = "<html><head><title></title>\n"
6363
+ "<script>\n"
6464
+ LOG_TITLE_FUNCTION
6565
+ "function safeTagName(o) {\n"
@@ -68,7 +68,7 @@ private void test(final String script) throws Exception {
6868
+ "function test() {\n"
6969
+ " try {\n";
7070

71-
private static final String contentEnd2 = "\n } catch(e) { log('exception') }\n"
71+
private static final String CONTENT_END2 = "\n } catch(e) { log('exception') }\n"
7272
+ "\n}\n</script></head>\n"
7373
+ "<body onload='test()'>\n"
7474
+ "<div id='theDiv'>Hello, <span id='theSpan'>this is a test for"
@@ -79,7 +79,7 @@ private void test(final String script) throws Exception {
7979
+ "</body></html>";
8080

8181
private void test2(final String script) throws Exception {
82-
final String html = contentStart2 + script + contentEnd2;
82+
final String html = CONTENT_START2 + script + CONTENT_END2;
8383

8484
loadPageVerifyTitle2(html);
8585
}

src/test/java/org/htmlunit/javascript/host/performance/PerformanceTimingTest.java

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
*/
3232
@RunWith(BrowserRunner.class)
3333
public class PerformanceTimingTest extends WebDriverTestCase {
34-
private static final long now = System.currentTimeMillis();
34+
private static final long NOE = System.currentTimeMillis();
3535

3636
/**
3737
* @throws Exception if the test fails
@@ -72,7 +72,7 @@ public void navigationStart() throws Exception {
7272
+ LOG_TITLE_FUNCTION
7373
+ " function test() {\n"
7474
+ " var performanceTiming = performance.timing;\n"
75-
+ " log(performanceTiming.navigationStart > " + now + ");\n"
75+
+ " log(performanceTiming.navigationStart > " + NOE + ");\n"
7676
+ " }\n"
7777
+ " test();\n"
7878
+ "</script>\n"
@@ -175,7 +175,7 @@ public void domainLookup() throws Exception {
175175
+ " function test() {\n"
176176
+ " var performanceTiming = performance.timing;\n"
177177
+ " var start = performanceTiming.domainLookupStart;\n"
178-
+ " log(start > " + now + ");\n"
178+
+ " log(start > " + NOE + ");\n"
179179
+ " log(performanceTiming.domainLookupEnd >= start);\n"
180180
+ " }\n"
181181
+ " test();\n"
@@ -202,7 +202,7 @@ public void response() throws Exception {
202202
+ " function test() {\n"
203203
+ " var performanceTiming = performance.timing;\n"
204204
+ " var start = performanceTiming.responseStart;\n"
205-
+ " log(start > " + now + ");\n"
205+
+ " log(start > " + NOE + ");\n"
206206
+ " log(performanceTiming.responseEnd >= start);\n"
207207
+ " }\n"
208208
+ " test();\n"
@@ -229,7 +229,7 @@ public void loadEvent() throws Exception {
229229
+ " function test() {\n"
230230
+ " var performanceTiming = performance.timing;\n"
231231
+ " var start = performanceTiming.loadEventStart;\n"
232-
+ " log(start > " + now + ");\n"
232+
+ " log(start > " + NOE + ");\n"
233233
+ " log(performanceTiming.loadEventEnd >= start);\n"
234234
+ " }\n"
235235
+ "</script>\n"
@@ -259,7 +259,7 @@ public void connect() throws Exception {
259259
+ " function test() {\n"
260260
+ " var performanceTiming = performance.timing;\n"
261261
+ " var start = performanceTiming.connectStart;\n"
262-
+ " log(start > " + now + ");\n"
262+
+ " log(start > " + NOE + ");\n"
263263
+ " log(performanceTiming.connectEnd >= start);\n"
264264
+ " }\n"
265265
+ " test();\n"
@@ -285,7 +285,7 @@ public void fetchStart() throws Exception {
285285
+ LOG_TITLE_FUNCTION
286286
+ " function test() {\n"
287287
+ " var performanceTiming = performance.timing;\n"
288-
+ " log(performanceTiming.fetchStart > " + now + ");\n"
288+
+ " log(performanceTiming.fetchStart > " + NOE + ");\n"
289289
+ " }\n"
290290
+ " test();\n"
291291
+ "</script>\n"
@@ -311,7 +311,7 @@ public void domContentLoadedEvent() throws Exception {
311311
+ " function test() {\n"
312312
+ " var performanceTiming = performance.timing;\n"
313313
+ " var start = performanceTiming.domContentLoadedEventStart;\n"
314-
+ " log(start > " + now + ");\n"
314+
+ " log(start > " + NOE + ");\n"
315315
+ " log(performanceTiming.domContentLoadedEventEnd >= start);\n"
316316
+ " }\n"
317317
+ "</script>\n"
@@ -340,11 +340,11 @@ public void dom() throws Exception {
340340
+ LOG_TITLE_FUNCTION
341341
+ " function test() {\n"
342342
+ " var performanceTiming = performance.timing;\n"
343-
+ " log(performanceTiming.domLoading > " + now + ");\n"
344-
+ " log(performanceTiming.domInteractive > " + now + ");\n"
345-
+ " log(performanceTiming.domContentLoadedEventStart > " + now + ");\n"
346-
+ " log(performanceTiming.domContentLoadedEventEnd > " + now + ");\n"
347-
+ " log(performanceTiming.domComplete > " + now + ");\n"
343+
+ " log(performanceTiming.domLoading > " + NOE + ");\n"
344+
+ " log(performanceTiming.domInteractive > " + NOE + ");\n"
345+
+ " log(performanceTiming.domContentLoadedEventStart > " + NOE + ");\n"
346+
+ " log(performanceTiming.domContentLoadedEventEnd > " + NOE + ");\n"
347+
+ " log(performanceTiming.domComplete > " + NOE + ");\n"
348348
+ " }\n"
349349
+ "</script>\n"
350350
+ "</head>\n"

src/test/java/org/htmlunit/javascript/host/xml/XMLHttpRequest3Test.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -391,7 +391,7 @@ public void ajaxInfluencesSubmitHeaders() throws Exception {
391391
servlets.put("/form_headers.html", FormHeaderServlet.class);
392392
startWebServer("./", null, servlets);
393393

394-
collectedHeaders_.clear();
394+
COLLECTED_HEADERS.clear();
395395
XMLHttpRequest3Test.STATE_ = 0;
396396
final WebClient client = getWebClient();
397397

@@ -406,24 +406,24 @@ public void ajaxInfluencesSubmitHeaders() throws Exception {
406406
((HtmlSubmitInput) elem).click();
407407

408408
client.waitForBackgroundJavaScript(DEFAULT_WAIT_TIME);
409-
assertEquals(collectedHeaders_.toString(), 2, collectedHeaders_.size());
409+
assertEquals(COLLECTED_HEADERS.toString(), 2, COLLECTED_HEADERS.size());
410410

411-
String headers = collectedHeaders_.get(0);
411+
String headers = COLLECTED_HEADERS.get(0);
412412
if (!headers.startsWith("Form: ")) {
413-
headers = collectedHeaders_.get(1);
413+
headers = COLLECTED_HEADERS.get(1);
414414
}
415415
assertTrue(headers, headers.startsWith("Form: "));
416416
assertFalse(headers, headers.contains("Html-Unit=is great,;"));
417417

418-
headers = collectedHeaders_.get(0);
418+
headers = COLLECTED_HEADERS.get(0);
419419
if (!headers.startsWith("Ajax: ")) {
420-
headers = collectedHeaders_.get(1);
420+
headers = COLLECTED_HEADERS.get(1);
421421
}
422422
assertTrue(headers, headers.startsWith("Ajax: "));
423423
assertTrue(headers, headers.contains("Html-Unit=is great,;"));
424424
}
425425

426-
static final List<String> collectedHeaders_ = Collections.synchronizedList(new ArrayList<String>());
426+
static final List<String> COLLECTED_HEADERS = Collections.synchronizedList(new ArrayList<String>());
427427
static int STATE_ = 0;
428428

429429
/**
@@ -485,7 +485,7 @@ protected void doGet(final HttpServletRequest request, final HttpServletResponse
485485
e.printStackTrace();
486486
}
487487

488-
collectedHeaders_.add("Ajax: " + header);
488+
COLLECTED_HEADERS.add("Ajax: " + header);
489489
response.setContentType(MimeType.TEXT_PLAIN);
490490
final Writer writer = response.getWriter();
491491
writer.write(header);
@@ -518,7 +518,7 @@ protected void doGet(final HttpServletRequest request, final HttpServletResponse
518518
+ "<p>Form: " + header + "</p<\n"
519519
+ "</body></html>";
520520

521-
collectedHeaders_.add("Form: " + header);
521+
COLLECTED_HEADERS.add("Form: " + header);
522522
response.setContentType(MimeType.TEXT_HTML);
523523
final Writer writer = response.getWriter();
524524
writer.write(html);

src/test/java/org/htmlunit/javascript/regexp/HtmlUnitRegExpProxy2Test.java

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,12 @@
3535
@RunWith(BrowserRunner.class)
3636
public class HtmlUnitRegExpProxy2Test extends SimpleWebTestCase {
3737

38-
private static final String str_ = "(?:<script.*?>)((\\n|\\r|.)*?)(?:<\\/script>)";
39-
private static final String begin_ = "<div>bla</div>";
40-
private static final String end_ = "foo\n<span>bla2</span>";
41-
private static final String text_ = begin_ + "<script>var a = 123;</script>" + end_;
42-
private static final String expected_ = begin_ + end_;
43-
private static final String src_ = "var re = new RegExp(str, 'img');\n"
38+
private static final String STR = "(?:<script.*?>)((\\n|\\r|.)*?)(?:<\\/script>)";
39+
private static final String BEGIN = "<div>bla</div>";
40+
private static final String END = "foo\n<span>bla2</span>";
41+
private static final String TEXT = BEGIN + "<script>var a = 123;</script>" + END;
42+
private static final String EXPECTED = BEGIN + END;
43+
private static final String SRC = "var re = new RegExp(str, 'img');\n"
4444
+ "var s = text.replace(re, '');\n"
4545
+ "if (s != expected)\n"
4646
+ " throw 'Expected >' + expected + '< but got >' + s + '<';";
@@ -88,10 +88,10 @@ public void fixedInHtmlUnit() throws Exception {
8888
final String html = "<html></html>";
8989
final HtmlPage page = loadPage(html);
9090
final ScriptableObject topScope = page.getEnclosingWindow().getScriptableObject();
91-
topScope.put("str", topScope, str_);
92-
topScope.put("text", topScope, text_);
93-
topScope.put("expected", topScope, expected_);
94-
page.executeJavaScript(src_);
91+
topScope.put("str", topScope, STR);
92+
topScope.put("text", topScope, TEXT);
93+
topScope.put("expected", topScope, EXPECTED);
94+
page.executeJavaScript(SRC);
9595
}
9696

9797
/**
@@ -104,12 +104,12 @@ public void needCustomFix() {
104104
final Context ctx = cf.enterContext();
105105
try {
106106
final ScriptableObject topScope = ctx.initStandardObjects();
107-
topScope.put("str", topScope, str_);
108-
topScope.put("text", topScope, text_);
109-
topScope.put("expected", topScope, expected_);
110-
assertEquals(begin_ + end_, text_.replaceAll(str_, ""));
107+
topScope.put("str", topScope, STR);
108+
topScope.put("text", topScope, TEXT);
109+
topScope.put("expected", topScope, EXPECTED);
110+
assertEquals(BEGIN + END, TEXT.replaceAll(STR, ""));
111111
try {
112-
ctx.evaluateString(topScope, src_, "test script", 0, null);
112+
ctx.evaluateString(topScope, SRC, "test script", 0, null);
113113
}
114114
catch (final JavaScriptException e) {
115115
assertTrue(e.getMessage().indexOf("Expected >") == 0);

src/test/java/org/htmlunit/javascript/regexp/HtmlUnitRegExpProxyTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
@RunWith(BrowserRunner.class)
3939
public class HtmlUnitRegExpProxyTest extends WebDriverTestCase {
4040

41-
private static final String scriptTestMatch_ = "function arrayToString(_arr) {\n"
41+
private static final String SCRIPT_TEST_MATCH = "function arrayToString(_arr) {\n"
4242
+ " if (_arr == null) return null;\n"
4343
+ " var s = '[';\n"
4444
+ " for (var i = 0; i < _arr.length; i++)\n"
@@ -242,7 +242,7 @@ public void replace() throws Exception {
242242
public void match() throws Exception {
243243
final String html = "<html><head><script>\n"
244244
+ LOG_TITLE_FUNCTION
245-
+ scriptTestMatch_
245+
+ SCRIPT_TEST_MATCH
246246
+ "</script></head><body>\n"
247247
+ "</body></html>";
248248

0 commit comments

Comments
 (0)