package io.appium.java_client.touch.offset;

import static com.google.common.base.Preconditions.checkArgument;
import static java.lang.String.format;
import static java.util.Optional.ofNullable;

import io.appium.java_client.touch.ActionOptions;
import org.openqa.selenium.Point;

import java.util.Map;

public class PointOption<T extends PointOption<T>> extends ActionOptions<T> {

    protected Point coordinates;

    private static final String ERROR_MESSAGE_TEMPLATE = "%s coordinate value should be equal or greater than zero";

    /**
     * It creates a built instance of {@link PointOption} which takes x and y coordinates.
     * This is offset from the upper left corner of the screen.
     *
     * @param xOffset is x value.
     * @param yOffset is y value.
     * @return a built option
     */
    public static PointOption point(int xOffset, int yOffset) {
        return new PointOption().withCoordinates(xOffset, yOffset);
    }

    /**
     * It defines x and y coordinates.
     * This is offset from the upper left corner of the screen.
     *
     * @param xOffset is x value.
     * @param yOffset is y value.
     * @return self-reference
     */
    public T withCoordinates(int xOffset, int yOffset) {
        checkArgument(xOffset >= 0, format(ERROR_MESSAGE_TEMPLATE, "X"));
        checkArgument(yOffset >= 0, format(ERROR_MESSAGE_TEMPLATE, "Y"));
        coordinates = new Point(xOffset, yOffset);
        return (T) this;
    }

    @Override
    protected void verify() {
        ofNullable(coordinates).orElseThrow(() -> new IllegalArgumentException(
                "Coordinate values must be defined"));
    }

    @Override
    public Map<String, Object> build() {
        final Map<String, Object> result = super.build();
        result.put("x", coordinates.x);
        result.put("y", coordinates.y);
        return result;
    }
}

@@ -42,113 +42,8 @@
 t;%0A%0A
-import static com.google.common.base.Preconditions.checkArgument;%0Aimport static java.lang.String.format;%0A
 impo
@@ -83,16 +83,16 @@
 llable;%0A
+
 %0Aimport 
@@ -309,126 +309,8 @@
 s;%0A%0A
-    private static final String ERROR_MESSAGE_TEMPLATE = %22%25s coordinate value should be equal or greater than zero%22;%0A%0A
     
@@ -1005,156 +1005,8 @@
 ) %7B%0A
-        checkArgument(xOffset %3E= 0, format(ERROR_MESSAGE_TEMPLATE, %22X%22));%0A        checkArgument(yOffset %3E= 0, format(ERROR_MESSAGE_TEMPLATE, %22Y%22));%0A
     
@@ -1048,24 +1048,57 @@
 , yOffset);%0A
+        //noinspection unchecked%0A
         retu
@@ -1127,24 +1127,24 @@
   @Override%0A
-
     protecte
@@ -1157,24 +1157,73 @@
  verify() %7B%0A
+        //noinspection ResultOfMethodCallIgnored%0A
         ofNu

Remove isPositive verification for point coordinates