Skip to content

Commit

Permalink
[java] Test code cleanup, deleting unused imports and never thrown ex…
Browse files Browse the repository at this point in the history
…ception declarations
  • Loading branch information
barancev committed Oct 1, 2019
1 parent be841f8 commit 982baeb
Show file tree
Hide file tree
Showing 14 changed files with 8 additions and 31 deletions.
2 changes: 0 additions & 2 deletions java/client/test/org/openqa/selenium/ClickScrollingTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@
import static org.openqa.selenium.support.ui.ExpectedConditions.presenceOfElementLocated;
import static org.openqa.selenium.support.ui.ExpectedConditions.titleIs;
import static org.openqa.selenium.testing.drivers.Browser.ALL;
import static org.openqa.selenium.testing.drivers.Browser.CHROME;
import static org.openqa.selenium.testing.drivers.Browser.CHROMIUMEDGE;
import static org.openqa.selenium.testing.drivers.Browser.EDGE;
import static org.openqa.selenium.testing.drivers.Browser.FIREFOX;
import static org.openqa.selenium.testing.drivers.Browser.HTMLUNIT;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
*/
public class ParallelTestRunner {
public interface Worker {
void run() throws Exception;
void run();
}

private static class WorkerThread extends Thread { // Thread safety reviewed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
import static org.assertj.core.api.Assertions.assertThat;
import static org.openqa.selenium.remote.CapabilityType.ACCEPT_INSECURE_CERTS;
import static org.openqa.selenium.support.ui.ExpectedConditions.titleIs;
import static org.openqa.selenium.testing.drivers.Browser.CHROME;

import org.junit.After;
import org.junit.Test;
Expand All @@ -30,8 +29,6 @@
import org.openqa.selenium.build.InProject;
import org.openqa.selenium.testing.JUnit4TestBase;
import org.openqa.selenium.testing.NeedsLocalEnvironment;
import org.openqa.selenium.testing.NotYetImplemented;
import org.openqa.selenium.testing.drivers.Browser;

import java.io.IOException;
import java.nio.file.Files;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
import java.io.IOException;
import java.util.Base64;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
Expand All @@ -30,8 +29,7 @@ public class BasicAuth extends HttpServlet {
private final Base64.Decoder decoder = Base64.getDecoder();

@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException,
IOException {
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException {
if (isAuthorized(req.getHeader("Authorization"))) {
resp.setHeader("Content-Type", "text/html");
resp.getWriter().write("<h1>authorized</h1>");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,13 @@

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class EncodingServlet extends HttpServlet {
@Override
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException {

response.setContentType("text/html");
// Data should be transferred using UTF-8. Pick a different encoding
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
Expand All @@ -28,8 +27,7 @@
public class PageServlet extends HttpServlet {

@Override
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException {
try {
Thread.sleep(500);
} catch (InterruptedException e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,14 @@

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class RedirectServlet extends HttpServlet {

@Override
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException {
response.sendRedirect("resultPage.html");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.function.BiConsumer;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@

import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
import static org.junit.Assert.fail;

import org.junit.Before;
import org.junit.Test;
Expand Down Expand Up @@ -141,7 +140,7 @@ public void shouldAllowSettingFrozenPreferences() throws Exception {
}

@Test
public void shouldAllowCheckingForChangesInFrozenPreferences() throws Exception {
public void shouldAllowCheckingForChangesInFrozenPreferences() {
profile.setPreference("network.http.phishy-userpass-length", 1024);
assertThatExceptionOfType(IllegalStateException.class).isThrownBy(
() -> profile.checkForChangesInFrozenPreferences()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@
import org.assertj.core.api.Assertions;
import org.junit.Test;

import java.net.HttpURLConnection;

public class RouteTest {

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,13 @@

package org.openqa.selenium.remote.http;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.fail;

import com.google.common.collect.ImmutableMap;

import org.junit.Assert;
import org.junit.Test;
import org.openqa.selenium.remote.http.UrlTemplate;

public class UrlTemplateTest {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,5 @@
*/
@FunctionalInterface
public interface TearDownFixture {
void tearDown() throws Exception;
void tearDown();
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,7 @@
import com.google.common.collect.ImmutableMap;

import org.openqa.selenium.Capabilities;
import org.openqa.selenium.ImmutableCapabilities;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.edge.EdgeDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.htmlunit.HtmlUnitDriver;
import org.openqa.selenium.ie.InternetExplorerDriver;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,8 @@
import org.openqa.selenium.os.CommandLine;
import org.openqa.selenium.build.InProject;

import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
import java.nio.file.Path;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.List;
Expand All @@ -53,7 +51,7 @@ public void enableLogCapture() {
*
* @return The new server.
*/
public OutOfProcessSeleniumServer start(String mode, String... extraFlags) throws IOException {
public OutOfProcessSeleniumServer start(String mode, String... extraFlags) {
log.info("Got a request to start a new selenium server");
if (command != null) {
log.info("Server already started");
Expand Down

0 comments on commit 982baeb

Please sign in to comment.