Skip to content

Commit

Permalink
Remove unused imports/methods/fields
Browse files Browse the repository at this point in the history
Signed-off-by: Alexei Barantsev <barancev@gmail.com>
  • Loading branch information
asashour authored and barancev committed Apr 12, 2017
1 parent 5b1e66f commit 1fee32b
Show file tree
Hide file tree
Showing 26 changed files with 17 additions and 71 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
import org.openqa.selenium.JavascriptExecutor;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.internal.WrapsDriver;
import org.openqa.selenium.remote.CapabilityType;

import java.util.Map;
import java.util.function.Supplier;
Expand Down
4 changes: 0 additions & 4 deletions java/client/src/org/openqa/selenium/Platform.java
Original file line number Diff line number Diff line change
Expand Up @@ -160,10 +160,6 @@ public Platform family() {
},

ANDROID("android", "dalvik") {
public String getLineEnding() {
return "\n";
}

@Override
public Platform family() {
return LINUX;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
import org.openqa.selenium.Capabilities;
import org.openqa.selenium.Proxy;
import org.openqa.selenium.WebDriverException;
import org.openqa.selenium.remote.BeanToJsonConverter;
import org.openqa.selenium.remote.CommandExecutor;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.remote.FileDetector;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -241,10 +241,6 @@ private Method getMethod(Class<?> clazz, String methodName) {
return null;
}

private Object convertJsonPrimitive(JsonElement json) {
return convertJsonPrimitive(json.getAsJsonPrimitive());
}

private Object convertJsonPrimitive(JsonPrimitive json) {
if (json.isBoolean()) {
return json.getAsBoolean();
Expand All @@ -260,7 +256,6 @@ private Object convertJsonPrimitive(JsonPrimitive json) {
}
}

@SuppressWarnings("unchecked")
private Enum convertEnum(Class clazz, Object text) {
String toConvert = text instanceof JsonElement ?
((JsonElement) text).getAsString() : String.valueOf(text);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -908,8 +908,8 @@ public Dimension getSize() {
return new Dimension(width, height);
}

@SuppressWarnings({"unchecked"})
Map<String, Object> rawPoint;
@SuppressWarnings("unchecked")
public Point getPosition() {
Response response = execute(DriverCommand.GET_CURRENT_WINDOW_POSITION,
ImmutableMap.of("windowHandle", "current"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,10 @@
package com.thoughtworks.selenium.corebased;

import static org.junit.Assume.assumeFalse;
import static org.junit.Assume.assumeTrue;

import com.thoughtworks.selenium.InternalSelenseTestBase;

import org.junit.Assume;
import org.junit.Test;
import org.openqa.selenium.HasCapabilities;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.environment.GlobalTestEnvironment;
import org.openqa.selenium.environment.webserver.AppServer;
import org.openqa.selenium.internal.WrapsDriver;
Expand Down
4 changes: 0 additions & 4 deletions java/client/test/org/openqa/selenium/ReferrerTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,10 @@

import static java.nio.charset.StandardCharsets.UTF_8;
import static org.junit.Assert.assertEquals;
import static org.junit.Assume.assumeFalse;
import static org.openqa.selenium.remote.CapabilityType.PROXY;
import static org.openqa.selenium.support.ui.ExpectedConditions.presenceOfElementLocated;
import static org.openqa.selenium.support.ui.ExpectedConditions.titleIs;
import static org.openqa.selenium.testing.Driver.FIREFOX;
import static org.openqa.selenium.testing.Driver.HTMLUNIT;
import static org.openqa.selenium.testing.Driver.IE;
import static org.openqa.selenium.testing.Driver.MARIONETTE;
import static org.openqa.selenium.testing.Driver.PHANTOMJS;
Expand Down Expand Up @@ -439,7 +437,6 @@ protected void after() {
*/
private abstract static class ServerResource extends ExternalResource {
protected final Server server;
private final int port;
private final HostAndPort hostAndPort;

ServerResource() {
Expand All @@ -450,7 +447,6 @@ private abstract static class ServerResource extends ExternalResource {
http.setPort(port);
http.setIdleTimeout(500000);

this.port = port;
this.server.addConnector(http);
this.hostAndPort = HostAndPort.fromParts("localhost", port);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -506,6 +506,7 @@ private boolean onlyWhite(Set<String> colors) {
*
* @param im image
*/
@SuppressWarnings("unused")
private void saveImageToTmpFile(BufferedImage im) {

File outputfile = new File( testName.getMethodName() + "_image.png");
Expand Down
1 change: 0 additions & 1 deletion java/client/test/org/openqa/selenium/TypingTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
import static org.junit.Assert.assertThat;
import static org.junit.Assume.assumeFalse;
import static org.openqa.selenium.WaitingConditions.elementValueToEqual;
import static org.openqa.selenium.testing.Driver.HTMLUNIT;
import static org.openqa.selenium.testing.Driver.IE;
import static org.openqa.selenium.testing.Driver.MARIONETTE;
import static org.openqa.selenium.testing.Driver.PHANTOMJS;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue;
import static org.junit.Assume.assumeFalse;
import static org.openqa.selenium.testing.Driver.HTMLUNIT;
import static org.openqa.selenium.testing.Driver.IE;
import static org.openqa.selenium.testing.Driver.MARIONETTE;
import static org.openqa.selenium.testing.Driver.SAFARI;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -442,7 +442,6 @@ public void testMoveMouseByOffsetOverAndOutOfAnElement() {

WebElement greenbox = driver.findElement(By.id("greenbox"));
WebElement redbox = driver.findElement(By.id("redbox"));
Dimension size = redbox.getSize();
Point greenboxPosition = greenbox.getLocation();
Point redboxPosition = redbox.getLocation();
int shiftX = redboxPosition.getX() - greenboxPosition.getX();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,7 @@ public void testShouldCallToJsonMethodIfPresent() {
@Test
public void toJsonMethodCanConvertibleReturnedMap() {
class ToJsonReturnsMap {
@SuppressWarnings("unused")
public Map<String, Object> toJson() {
return ImmutableMap.of("cheese", "peas");
}
Expand All @@ -253,6 +254,7 @@ public Map<String, Object> toJson() {
@Test
public void toJsonMethodCanConvertReturnedCollection() {
class ToJsonReturnsCollection {
@SuppressWarnings("unused")
public Set<String> toJson() {
return ImmutableSortedSet.of("cheese", "peas");
}
Expand Down Expand Up @@ -377,6 +379,7 @@ class Bean {
this.date = date;
}

@SuppressWarnings("unused")
public Date getDate() {
return date;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ public void testCauseStackTraceShouldBeEmptyIfTheServerDidNotProvideThatInformat
}
}

@SuppressWarnings({"unchecked", "ThrowableInstanceNeverThrown"})
@SuppressWarnings("ThrowableInstanceNeverThrown")
@Test
public void testShouldBeAbleToRebuildASerializedException() throws Exception {
RuntimeException serverError = new RuntimeException("foo bar baz!\nCommand duration or timeout: 123 milliseconds");
Expand All @@ -238,7 +238,7 @@ public void testShouldBeAbleToRebuildASerializedException() throws Exception {
}
}

@SuppressWarnings({"unchecked", "ThrowableInstanceNeverThrown"})
@SuppressWarnings("ThrowableInstanceNeverThrown")
@Test
public void testShouldIncludeScreenshotIfProvided() throws Exception {
RuntimeException serverError = new RuntimeException("foo bar baz!");
Expand Down Expand Up @@ -266,7 +266,7 @@ public void testShouldIncludeScreenshotIfProvided() throws Exception {
}
}

@SuppressWarnings({"unchecked", "ThrowableInstanceNeverThrown"})
@SuppressWarnings("ThrowableInstanceNeverThrown")
@Test
public void testShouldDefaultToWebDriverExceptionIfClassIsNotSpecified()
throws Exception {
Expand All @@ -291,7 +291,7 @@ public void testShouldDefaultToWebDriverExceptionIfClassIsNotSpecified()
}
}

@SuppressWarnings({"unchecked", "ThrowableInstanceNeverThrown"})
@SuppressWarnings("ThrowableInstanceNeverThrown")
@Test
public void testShouldStillTryToBuildWebDriverExceptionIfClassIsNotProvidedAndStackTraceIsNotForJava() {
Map<String, ?> data = ImmutableMap.of(
Expand Down Expand Up @@ -326,7 +326,7 @@ public void testShouldStillTryToBuildWebDriverExceptionIfClassIsNotProvidedAndSt
}
}

@SuppressWarnings({"unchecked", "ThrowableInstanceNeverThrown"})
@SuppressWarnings("ThrowableInstanceNeverThrown")
@Test
public void testToleratesNonNumericLineNumber() {
Map<String, ?> data = ImmutableMap.of(
Expand Down Expand Up @@ -361,7 +361,7 @@ public void testToleratesNonNumericLineNumber() {
}
}

@SuppressWarnings({"unchecked", "ThrowableInstanceNeverThrown"})
@SuppressWarnings("ThrowableInstanceNeverThrown")
@Test
public void testToleratesNumericLineNumberAsString() {
Map<String, ?> data = ImmutableMap.of(
Expand Down Expand Up @@ -396,7 +396,7 @@ public void testToleratesNumericLineNumberAsString() {
}
}

@SuppressWarnings({"unchecked", "ThrowableInstanceNeverThrown"})
@SuppressWarnings("ThrowableInstanceNeverThrown")
@Test
public void testShouldIndicateWhenTheServerReturnedAnExceptionThatWasSuppressed()
throws Exception {
Expand All @@ -415,7 +415,7 @@ public void testShouldIndicateWhenTheServerReturnedAnExceptionThatWasSuppressed(
}
}

@SuppressWarnings({"unchecked", "ThrowableInstanceNeverThrown"})
@SuppressWarnings("ThrowableInstanceNeverThrown")
@Test
public void testShouldStillIncludeScreenshotEvenIfServerSideExceptionsAreDisabled()
throws Exception {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,6 @@ public void testShouldRecognizeNumericStatus() {

assertEquals(0, response.getStatus().intValue());
assertEquals(new ErrorCodes().toState(0), response.getState());
@SuppressWarnings("unchecked")
String value = (String) response.getValue();
assertEquals("cheese", value);
}
Expand All @@ -400,7 +399,6 @@ public void testShouldRecognizeStringStatus() {

assertEquals(0, response.getStatus().intValue());
assertEquals(new ErrorCodes().toState(0), response.getState());
@SuppressWarnings("unchecked")
String value = (String) response.getValue();
assertEquals("cheese", value);
}
Expand All @@ -420,7 +418,6 @@ public void testShouldRecognizeStringState() {

assertEquals("success", response.getState());
assertEquals(0, response.getStatus().intValue());
@SuppressWarnings("unchecked")
String value = (String) response.getValue();
assertEquals("cheese", value);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
import org.openqa.selenium.remote.http.HttpClient;
import org.openqa.selenium.remote.http.HttpRequest;
import org.openqa.selenium.remote.http.HttpResponse;
import org.openqa.selenium.remote.http.W3CHttpCommandCodec;

import java.io.IOException;
import java.util.Collection;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@ public void unwrapsWrappedElements_multipleLevelsOfWrapping() {
assertIsWebElementObject(value, "abc123");
}

@SuppressWarnings("unchecked")
@Test
public void convertsSimpleCollections() {
Object converted = CONVERTER.apply(Lists.newArrayList(null, "abc", true, 123, Math.PI));
Expand All @@ -102,7 +101,6 @@ public void convertsSimpleCollections() {
assertContentsInOrder(list, null, "abc", true, 123, Math.PI);
}

@SuppressWarnings("unchecked")
@Test
public void convertsNestedCollections_simpleValues() {
List<?> innerList = Lists.newArrayList(123, "abc");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,6 @@
import java.lang.reflect.Field;
import java.util.List;

/**
*/
@RunWith(JUnit4.class)
public class DefaultFieldDecoratorTest {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
// specific language governing permissions and limitations
// under the License.


package org.openqa.selenium.support.pagefactory;

import static org.hamcrest.Matchers.equalTo;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ public class OutOfProcessSeleniumServer {

private String baseUrl;
private CommandLine command;
@SuppressWarnings("unused")
private boolean captureLogs = false;

public void enableLogCapture() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ private enum LogLevel {
WARNING("WARNING", Level.WARNING),
ERROR("ERROR", Level.SEVERE);

@SuppressWarnings("unused")
private final String value;
private final Level level;

Expand Down
19 changes: 0 additions & 19 deletions java/server/src/org/openqa/grid/internal/BaseRemoteProxy.java
Original file line number Diff line number Diff line change
Expand Up @@ -174,25 +174,6 @@ public void setupTimeoutListener() {
}
}

/**
* merge the param from config 1 and 2. If a param is present in both, config2 value is used.
*
* @param configuration1 The first configuration to merge (recessive)
* @param configuration2 The second configuration to merge (dominant)
* @return The merged collection
*/
private Map<String, Object> mergeConfig(Map<String, Object> configuration1,
Map<String, Object> configuration2) {
Map<String, Object> res = new HashMap<>();
res.putAll(configuration1);

for (String key : configuration2.keySet()) {
res.put(key, configuration2.get(key));
}

return res;
}

public String getId() {
if (id == null) {
throw new RuntimeException("Bug. Trying to use the id on a proxy but it hasn't been set.");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
import org.openqa.selenium.remote.DesiredCapabilities;

import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
import java.util.logging.Level;
import java.util.logging.Logger;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -233,10 +233,8 @@ private static HttpRequest createInternalRequest(HttpServletRequest servletReque
HttpMethod.valueOf(servletRequest.getMethod().toUpperCase()),
path);

@SuppressWarnings("unchecked")
Enumeration<String> headerNames = servletRequest.getHeaderNames();
for (String name : list(headerNames)) {
@SuppressWarnings("unchecked")
Enumeration<String> headerValues = servletRequest.getHeaders(name);
for (String value : list(headerValues)) {
request.setHeader(name, value);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ public FindChildElement(Session session) {
super(session);
}

@SuppressWarnings("unchecked")
public void setJsonParameters(Map<String, Object> allParameters) throws Exception {
by = newBySelector().pickFromJsonParameters(allParameters);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,14 +114,6 @@ public Boolean call() throws Exception {
};
}

private Callable<Boolean> isDown(final DefaultRemoteProxy proxy) {
return new Callable<Boolean>() {
public Boolean call() throws Exception {
return proxy.isDown();
}
};
}

private String getProxyId() throws Exception {
RemoteProxy p = null;
Iterator<RemoteProxy> it = registry.getAllProxies().iterator();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -202,9 +202,11 @@ public void testShouldCallAConstructorTakingACapabilitiesArgInPreferenceToANoArg
private static class CapabilitiesDriver extends StubDriver {
private Capabilities caps;

@SuppressWarnings("unused")
public CapabilitiesDriver() {
}

@SuppressWarnings("unused")
public CapabilitiesDriver(Capabilities caps) {
this.caps = caps;
}
Expand Down

0 comments on commit 1fee32b

Please sign in to comment.