Skip to content

Commit 757eb82

Browse files
committed
checkstyle
1 parent c0e813f commit 757eb82

11 files changed

Lines changed: 32 additions & 33 deletions

src/test/java/org/htmlunit/NoHttpResponseTest.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
*/
4141
@RunWith(Enclosed.class)
4242
public class NoHttpResponseTest {
43-
private static final String html
43+
private static final String HTML
4444
= "<html><body><script>\n"
4545
+ " function fillField() {\n"
4646
+ " document.forms.loginform.textfield.value = 'new value';\n"
@@ -76,7 +76,7 @@ public void after() throws Exception {
7676
FF_ESR = "§§URL§§page2?textfield=")
7777
public void submit() throws Exception {
7878
final MockWebConnection mockWebConnection = getMockWebConnection();
79-
mockWebConnection.setResponse(URL_FIRST, html);
79+
mockWebConnection.setResponse(URL_FIRST, HTML);
8080
MiniServer.configureDropRequest(new URL(URL_FIRST, "page2?textfield="));
8181
final URL urlRightSubmit = new URL(URL_FIRST, "page2?textfield=new+value");
8282
mockWebConnection.setResponse(urlRightSubmit, "<html><head><title>right submit</title></head></html>");
@@ -103,7 +103,7 @@ public void submit() throws Exception {
103103
@Alerts("right submit")
104104
public void callSubmitInButtonAndReturnTrue() throws Exception {
105105
final MockWebConnection mockWebConnection = getMockWebConnection();
106-
mockWebConnection.setResponse(URL_FIRST, html);
106+
mockWebConnection.setResponse(URL_FIRST, HTML);
107107
MiniServer.configureDropRequest(new URL(URL_FIRST, "page2?textfield="));
108108
final URL urlRightSubmit = new URL(URL_FIRST, "page2?textfield=new+value");
109109
mockWebConnection.setResponse(urlRightSubmit, "<html><head><title>right submit</title></head></html>");
@@ -137,7 +137,7 @@ public void after() throws Exception {
137137
@Test(expected = FailingHttpStatusCodeException.class)
138138
public void submit() throws Throwable {
139139
final MockWebConnection mockWebConnection = getMockWebConnection();
140-
mockWebConnection.setResponse(URL_FIRST, html);
140+
mockWebConnection.setResponse(URL_FIRST, HTML);
141141
MiniServer.configureDropRequest(new URL(URL_FIRST, "page2?textfield="));
142142
final URL urlRightSubmit = new URL(URL_FIRST, "page2?textfield=new+value");
143143
mockWebConnection.setResponse(urlRightSubmit, "<html><head><title>right submit</title></head></html>");
@@ -159,7 +159,7 @@ public void submit() throws Throwable {
159159
@Test
160160
public void callSubmitInButtonAndReturnTrue() throws Throwable {
161161
final MockWebConnection mockWebConnection = getMockWebConnection();
162-
mockWebConnection.setResponse(URL_FIRST, html);
162+
mockWebConnection.setResponse(URL_FIRST, HTML);
163163
MiniServer.configureDropRequest(new URL(URL_FIRST, "page2?textfield="));
164164
final URL urlRightSubmit = new URL(URL_FIRST, "page2?textfield=new+value");
165165
mockWebConnection.setResponse(urlRightSubmit, "<html><head><title>right submit</title></head></html>");

src/test/java/org/htmlunit/WebClientTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -707,7 +707,7 @@ public void setPageCreator() throws Exception {
707707
private static class CollectingPageCreator implements PageCreator {
708708
private final List<Page> collectedPages_;
709709

710-
private static final HTMLParser htmlParser_ = new HtmlUnitNekoHtmlParser();
710+
private static final HTMLParser HTML_PARSER = new HtmlUnitNekoHtmlParser();
711711

712712
/**
713713
* Creates an instance.
@@ -734,7 +734,7 @@ public Page createPage(final WebResponse webResponse, final WebWindow webWindow)
734734

735735
@Override
736736
public HTMLParser getHtmlParser() {
737-
return htmlParser_;
737+
return HTML_PARSER;
738738
}
739739
}
740740

src/test/java/org/htmlunit/general/huge/ElementClosesElementTest.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -47,23 +47,23 @@ public class ElementClosesElementTest extends WebDriverTestCase {
4747

4848
private static int ServerRestartCount_;
4949

50-
private static final List<String> parentZero = Arrays.asList("area", "base", "basefont", "bgsound", "br",
50+
private static final List<String> PARENT_ZERO = Arrays.asList("area", "base", "basefont", "bgsound", "br",
5151
"command", "col", "colgroup",
5252
"embed", "frame", "frameset", "head", "hr", "iframe", "image", "img", "input", "keygen",
5353
"link", "meta", "noembed", "noframes", "noscript", "param", "plaintext",
5454
"script", "select", "source", "style",
5555
"table", "tbody", "template", "textarea", "tfoot", "thead", "title",
5656
"tr", "track", "wbr", "xmp");
5757

58-
private static final List<String> childZero = Arrays.asList("body", "caption", "col", "colgroup",
58+
private static final List<String> CHILD_ZERO = Arrays.asList("body", "caption", "col", "colgroup",
5959
"frame", "frameset", "head", "html", "tbody", "td", "tfoot", "th", "thead", "tr");
6060

61-
private static final List<String> svgChildZero = Arrays.asList("b", "big", "blockquote", "body", "br",
61+
private static final List<String> SVG_CHILD_ZERO = Arrays.asList("b", "big", "blockquote", "body", "br",
6262
"center", "code", "dd", "div", "dl", "dt", "em", "embed", "h1", "h2", "h3", "h4", "h5", "h6", "head",
6363
"hr", "i", "img", "li", "listing", "menu", "meta", "nobr", "ol", "p", "pre", "ruby", "s", "small",
6464
"span", "strike", "strong", "sub", "sup", "table", "tt", "u", "ul", "var");
6565

66-
private static final String resultScript = " var e = document.getElementById('outer');\n"
66+
private static final String RESULT_SCRIPT = " var e = document.getElementById('outer');\n"
6767
+ " var res = '-';\n"
6868
+ " try {\n"
6969
+ " res = e == null ? e : e.children.length;\n"
@@ -171,10 +171,10 @@ else if ("title".equals(parent)) {
171171
expected = getExpectedAlerts()[0];
172172
}
173173
else {
174-
if (childZero.contains(child)) {
174+
if (CHILD_ZERO.contains(child)) {
175175
expected = "0";
176176
}
177-
else if (parentZero.contains(parent)) {
177+
else if (PARENT_ZERO.contains(parent)) {
178178
expected = "0";
179179
}
180180
else if ("html".equals(parent)) {
@@ -183,7 +183,7 @@ else if ("html".equals(parent)) {
183183

184184
if ("svg".equals(parent)) {
185185
expected = "1";
186-
if (svgChildZero.contains(child)) {
186+
if (SVG_CHILD_ZERO.contains(child)) {
187187
expected = "0";
188188
}
189189
}
@@ -207,7 +207,7 @@ else if ("html".equals(parent)) {
207207

208208
loadPage2(pageHtml);
209209

210-
final String result = (String) ((JavascriptExecutor) driver).executeScript(resultScript);
210+
final String result = (String) ((JavascriptExecutor) driver).executeScript(RESULT_SCRIPT);
211211
assertEquals(expected, result);
212212
}
213213

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
@RunWith(BrowserRunner.class)
3535
public class HtmlTableRowTest extends SimpleWebTestCase {
3636

37-
private static final String htmlContent = "<html><head><title>foo</title></head><body>\n"
37+
private static final String HTML = "<html><head><title>foo</title></head><body>\n"
3838
+ "<table id='table'><tr id='row'>\n"
3939
+ "<td id='cell' width='20'><input type='text' id='foo'/></td>\n"
4040
+ "</tr></table>\n"
@@ -54,7 +54,7 @@ public class HtmlTableRowTest extends SimpleWebTestCase {
5454
*/
5555
@Before
5656
public void init() throws Exception {
57-
page_ = loadPage(htmlContent);
57+
page_ = loadPage(HTML);
5858

5959
table_ = page_.getHtmlElementById("table");
6060
tbody_ = (HtmlTableBody) table_.getFirstChild();

src/test/java/org/htmlunit/html/parser/HTMLParser3Test.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,14 +91,14 @@ private void headerVsMetaTagContentType(final boolean utf8Encoded) throws Except
9191

9292
final WebClient client = getWebClient();
9393
final HtmlPage page = client.getPage(URL_FIRST + "test");
94-
assertEquals(utf8Encoded, HeaderVsMetaTagContentTypeServlet.utf8String.equals(page.asNormalizedText()));
94+
assertEquals(utf8Encoded, HeaderVsMetaTagContentTypeServlet.UTF8_STRING.equals(page.asNormalizedText()));
9595
}
9696

9797
/**
9898
* Servlet for headerVsMetaTagContentType(boolean).
9999
*/
100100
public static class HeaderVsMetaTagContentTypeServlet extends HttpServlet {
101-
private static final String utf8String = "\u064A\u0627 \u0644\u064A\u064A\u064A\u064A\u0644";
101+
private static final String UTF8_STRING = "\u064A\u0627 \u0644\u064A\u064A\u064A\u064A\u0644";
102102
private static Charset HEADER_ENCODING_;
103103
private static Charset META_TAG_ENCODING_;
104104

@@ -121,7 +121,7 @@ protected void doGet(final HttpServletRequest request, final HttpServletResponse
121121
if (META_TAG_ENCODING_ != null) {
122122
html += "<META HTTP-EQUIV='Content-Type' CONTENT='text/html; charset=" + META_TAG_ENCODING_ + "'>";
123123
}
124-
html += "</head><body>" + utf8String + "</body></html>";
124+
html += "</head><body>" + UTF8_STRING + "</body></html>";
125125
writer.write(html);
126126
}
127127
}

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public class HtmlUnitRegExpProxy2Test extends SimpleWebTestCase {
4545
+ "if (s != expected)\n"
4646
+ " throw 'Expected >' + expected + '< but got >' + s + '<';";
4747

48-
private static final String scriptTestMatch_ = "function arrayToString(_arr) {\n"
48+
private static final String SCRIPT_TEST_MATCH = "function arrayToString(_arr) {\n"
4949
+ " if (_arr == null) return null;\n"
5050
+ " var s = '[';\n"
5151
+ " for (var i = 0; i < _arr.length; i++)\n"
@@ -133,9 +133,9 @@ public void matchFixNeeded() throws Exception {
133133
final Context cx = cf.enterContext();
134134
try {
135135
final ScriptableObject topScope = cx.initStandardObjects();
136-
cx.evaluateString(topScope, scriptTestMatch_, "test script String.match", 0, null);
136+
cx.evaluateString(topScope, SCRIPT_TEST_MATCH, "test script String.match", 0, null);
137137
try {
138-
cx.evaluateString(topScope, scriptTestMatch_, "test script String.match", 0, null);
138+
cx.evaluateString(topScope, SCRIPT_TEST_MATCH, "test script String.match", 0, null);
139139
}
140140
catch (final JavaScriptException e) {
141141
assertTrue(e.getMessage().indexOf("Expected >") == 0);

src/test/java/org/htmlunit/junit/BrowserStatement.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ public void evaluate() throws Throwable {
6565
if (notYetImplemented_) {
6666
throw ex;
6767
}
68-
if (BrowserVersionClassRunner.maven_) {
68+
if (BrowserVersionClassRunner.MAVEN) {
6969
System.out.println("Failed test "
7070
+ method_.getDeclaringClass().getName() + '.' + method_.getName()
7171
+ (tries_ != 1 ? " #" + (i + 1) : ""));

src/test/java/org/htmlunit/junit/BrowserVersionClassRunner.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public class BrowserVersionClassRunner extends BlockJUnit4ClassRunner {
6060

6161
private final BrowserVersion browserVersion_;
6262
private final boolean realBrowser_;
63-
static final boolean maven_ = System.getProperty("htmlunit.maven") != null;
63+
static final boolean MAVEN = System.getProperty("htmlunit.maven") != null;
6464

6565
/**
6666
* Constructs a new instance.
@@ -235,7 +235,7 @@ protected String testName(final FrameworkMethod method) {
235235
if (realBrowser_) {
236236
browserString = "Real " + browserString;
237237
}
238-
if (!maven_) {
238+
if (!MAVEN) {
239239
return String.format("%s [%s]", method.getName(), browserString);
240240
}
241241
String className = method.getMethod().getDeclaringClass().getName();

src/test/java/org/htmlunit/junit/BrowserVersionClassRunnerWithParameters.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ protected String testName(final FrameworkMethod method) {
135135

136136
final String methodName = method.getName();
137137

138-
if (!maven_) {
138+
if (!MAVEN) {
139139
return String.format("%s [%s]", methodName, browserString);
140140
}
141141
String className = method.getMethod().getDeclaringClass().getName();

src/test/java/org/htmlunit/libraries/JQueryTestBase.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@
3232
import org.htmlunit.WebServerTestCase;
3333
import org.htmlunit.http.HttpStatus;
3434
import org.htmlunit.junit.BrowserRunner;
35-
import org.htmlunit.util.NameValuePair;
3635
import org.htmlunit.util.WebConnectionWrapper;
3736
import org.junit.AfterClass;
3837
import org.junit.Before;
@@ -66,10 +65,10 @@ public abstract class JQueryTestBase extends WebDriverTestCase {
6665
}
6766

6867
private static final class OnlyLocalConnectionWrapper extends WebConnectionWrapper {
69-
private static final WebResponseData responseData =
68+
private static final WebResponseData RESPONSE_DATA =
7069
new WebResponseData("not found".getBytes(StandardCharsets.US_ASCII),
7170
HttpStatus.NOT_FOUND_404, HttpStatus.NOT_FOUND_404_MSG,
72-
new ArrayList<NameValuePair>());
71+
new ArrayList<>());
7372

7473

7574
private OnlyLocalConnectionWrapper(final WebClient webClient) {
@@ -85,7 +84,7 @@ public WebResponse getResponse(final WebRequest request) throws IOException {
8584
}
8685

8786

88-
return new WebResponse(responseData, request, 0);
87+
return new WebResponse(RESPONSE_DATA, request, 0);
8988
}
9089
}
9190

0 commit comments

Comments
 (0)