@Nonnull public Builder newBuilder() { return new Builder(product_id, start_latitude, start_longitude, start_nickname, start_address, start_place_id, end_latitude, end_longitude, end_nickname, end_address, end_place_id, surge_confirmation_id, payment_method_id, seat_count, fare_id); }
/** * Builds a {@link RideRequestParameters}. */ public RideRequestParameters build() { validate(); return new RideRequestParameters(productId, startLatitude, startLongitude, startNickname, startAddress, startPlaceId, endLatitude, endLongitude, endNickname, endAddress, endPlaceId, surgeConfirmationId, paymentMethodId, seatCount, fareId); } }
/** * Builds a {@link RideRequestParameters}. */ public RideRequestParameters build() { validate(); return new RideRequestParameters(productId, startLatitude, startLongitude, startNickname, startAddress, startPlaceId, endLatitude, endLongitude, endNickname, endAddress, endPlaceId, surgeConfirmationId, paymentMethodId, seatCount, fareId); } }
@Test public void onBuild_whenJustDropoffPlaceProvided_shouldSucceed() throws Exception { new RideRequestParameters.Builder().setPickupPlace(HOME).setDropoffPlace(HOME).build(); }
@Test public void onBuild_whenJustDropoffPlaceIdProvided_shouldSucceed() throws Exception { new RideRequestParameters.Builder().setPickupPlace(HOME).setDropoffPlaceId("home").build(); }
@Test public void onBuild_whenJustDropoffCoordinatesProvided_shouldSucceed() throws Exception { new RideRequestParameters.Builder().setPickupPlace(HOME).setDropoffCoordinates(30f, -122f).build(); }
@Test public void onBuild_whenJustPickupPlaceProvided_shouldSucceed() throws Exception { new RideRequestParameters.Builder().setPickupPlace(HOME); }
@Test public void onBuild_whenJustPickupPlaceIdProvided_shouldSucceed() throws Exception { new RideRequestParameters.Builder().setPickupPlaceId("home"); }
@Test public void build_whenJustPickupLatitudeProvided_shouldFail() throws Exception { exception.expect(IllegalArgumentException.class); exception.expectMessage("If using coordinates, both pickup latitude and pickup longitude " + "must be present"); new RideRequestParameters.Builder().setPickupCoordinates(30f, null).build(); }
@Test public void onBuild_whenJustPickupCoordinatesProvided_shouldSucceed() throws Exception { new RideRequestParameters.Builder().setPickupCoordinates(30f, -122f); }
@Test public void build_whenBothPickupPlaceAndLongitudeProvided_shouldFail() throws Exception { exception.expect(IllegalArgumentException.class); exception.expectMessage("Exactly one of pickup place or pickup coordinates must " + "be specified"); new RideRequestParameters.Builder().setPickupCoordinates(null, -122f).setPickupPlace(HOME).build(); }
@Test public void build_whenBothPickupPlaceAndCoordinatesProvided_shouldFail() throws Exception { exception.expect(IllegalArgumentException.class); exception.expectMessage("Exactly one of pickup place or pickup coordinates must " + "be specified"); new RideRequestParameters.Builder().setPickupCoordinates(30f, -122f).setPickupPlace(HOME).build(); }
@Test public void build_whenJustDropoffLatitudeProvided_shouldFail() throws Exception { exception.expect(IllegalArgumentException.class); exception.expectMessage("If using coordinates, both dropoff latitude and dropoff " + "longitude must be present"); new RideRequestParameters.Builder() .setPickupPlace(HOME) .setDropoffCoordinates(30f, null).build(); }
private static RideRequestParameters createUberPoolRideRequestV1Estimate() { return new RideRequestParameters.Builder() .setPickupCoordinates(PICKUP_LATITUDE, PICKUP_LONGITUDE) .setDropoffCoordinates(DROPOFF_LATITUDE, DROPOFF_LONGITUDE) .setProductId(UBER_POOL_PRODUCT_ID) .setSeatCount(4) .build(); }
private static RideRequestParameters createUberPoolRideRequest() { return new RideRequestParameters.Builder() .setPickupCoordinates(PICKUP_LATITUDE, PICKUP_LONGITUDE) .setDropoffCoordinates(DROPOFF_LATITUDE, DROPOFF_LONGITUDE) .setProductId(UBER_POOL_PRODUCT_ID) .setSeatCount(2) .build(); }
@Test public void build_whenBothPickupPlaceAndLatitudeProvided_shouldFail() throws Exception { exception.expect(IllegalArgumentException.class); exception.expectMessage("Exactly one of pickup place or pickup coordinates must " + "be specified"); new RideRequestParameters.Builder().setPickupCoordinates(30f, null).setPickupPlace(HOME).build(); }
@Nonnull public Builder newBuilder() { return new Builder(product_id, start_latitude, start_longitude, start_nickname, start_address, start_place_id, end_latitude, end_longitude, end_nickname, end_address, end_place_id, surge_confirmation_id, payment_method_id, seat_count, fare_id); }
@Test public void build_whenBothDropoffPlaceAndLongitudeProvided_shouldFail() throws Exception { exception.expect(IllegalArgumentException.class); exception.expectMessage("Exactly one of dropoff place or dropoff coordinates must " + "be specified"); new RideRequestParameters.Builder() .setPickupPlace(HOME) .setDropoffCoordinates(null, -122f) .setDropoffPlace(HOME) .build(); }
@Test public void build_whenBothDropoffPlaceAndCoordinatesProvided_shouldFail() throws Exception { exception.expect(IllegalArgumentException.class); exception.expectMessage("Exactly one of dropoff place or dropoff coordinates must " + "be specified"); new RideRequestParameters.Builder() .setPickupPlace(HOME) .setDropoffCoordinates(30f, -122f) .setDropoffPlace(HOME) .build(); }
@Test public void build_whenBothDropoffPlaceIdAndCoordinatesProvided_shouldFail() throws Exception { exception.expect(IllegalArgumentException.class); exception.expectMessage("Exactly one of dropoff place or dropoff coordinates must " + "be specified"); new RideRequestParameters.Builder() .setPickupPlace(HOME) .setDropoffCoordinates(30f, -122f) .setDropoffPlaceId("home") .build(); }