Skip to content

Response returns long. #2504

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 21, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 24 additions & 7 deletions java/client/src/org/openqa/selenium/DeviceRotation.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,10 @@ public class DeviceRotation {
* @param z
*/
public DeviceRotation(int x, int y, int z) {
this.validateParameters(x, y, z);
this.x = x;
this.y = y;
this.z = z;
this.validateParameters(this.x, this.y, this.z);
}

/**
Expand All @@ -54,19 +54,21 @@ public DeviceRotation(int x, int y, int z) {
* z : zVal
* @param map
*/
public DeviceRotation(Map<String, Integer> map) {
public DeviceRotation(Map<String, Number> map) {
if (map == null || !map.containsKey("x") || !map.containsKey("y") || !map.containsKey("z")) {
throw new IllegalArgumentException("Could not initialize DeviceRotation with map given: " + map.toString());
}
this.validateParameters(map.get("x"), map.get("y"), map.get("z"));
this.x = map.get("x");
this.y = map.get("y");
this.z = map.get("z");
this.x = map.get("x").intValue();
this.y = map.get("y").intValue();
this.z = map.get("z").intValue();
this.validateParameters(x, y, z);
}

private void validateParameters(int x, int y, int z) {
if (x < 0 || y < 0 || z < 0) {
throw new IllegalArgumentException("DeviceRotation requires positive axis values: \nx = " + x + "\ny = " + y + "\nz = " + z);
} else if (x >= 360 || y >= 360 || z >= 360) {
throw new IllegalArgumentException("DeviceRotation requires positive axis values under 360: \nx = " + x + "\ny = " + y + "\nz = " + z);
}
}

Expand Down Expand Up @@ -97,6 +99,21 @@ public int getZ() {
public ImmutableMap<String,Integer> parameters() {
return ImmutableMap.of("x", this.x, "y", this.y, "z", this.z);
}


@Override
public boolean equals(Object o)
{
if (!(o instanceof DeviceRotation)) {
return false;
}
if (o == this) {
return true;
}

DeviceRotation obj = (DeviceRotation)o;
if (obj.getX() != this.getX() || obj.getY() != this.getY() || obj.getZ() != this.getZ()) {
return false;
}
return true;
}
}