diff --git a/src/main/java/com/easypost/service/ShipmentService.java b/src/main/java/com/easypost/service/ShipmentService.java index e033352e3..e4a7916b1 100644 --- a/src/main/java/com/easypost/service/ShipmentService.java +++ b/src/main/java/com/easypost/service/ShipmentService.java @@ -21,6 +21,7 @@ import java.util.List; import java.util.Map; import java.util.function.Function; +import com.google.errorprone.annotations.InlineMe; public class ShipmentService { private final EasyPostClient client; @@ -191,7 +192,9 @@ public Shipment newRates(final String id, final Map params, fina * Deprecated: v5.5.0 - v7.0.0 */ @Deprecated - public List getSmartrates(final String id, final Map params) throws EasyPostException { + @InlineMe(replacement = "this.smartrates(id, params)") + public final List getSmartrates(final String id, final Map params) + throws EasyPostException { return this.smartrates(id, params); } @@ -402,7 +405,11 @@ public Shipment insure(final String id, final Map params) throws * Deprecated: v5.5.0 - v7.0.0 */ @Deprecated - public SmartRate lowestSmartRate(final String id, int deliveryDay, String deliveryAccuracy) + @InlineMe( + replacement = "this.lowestSmartRate(id, deliveryDay, SmartrateAccuracy.getByKeyName(deliveryAccuracy))", + imports = "com.easypost.model.SmartrateAccuracy" + ) + public final SmartRate lowestSmartRate(final String id, int deliveryDay, String deliveryAccuracy) throws EasyPostException { return this.lowestSmartRate(id, deliveryDay, SmartrateAccuracy.getByKeyName(deliveryAccuracy)); } @@ -436,8 +443,9 @@ public SmartRate lowestSmartRate(final String id, final int deliveryDay, Smartra * Deprecated: v5.5.0 - v7.0.0 */ @Deprecated - public List getSmartrates(final String id) throws EasyPostException { - return this.getSmartrates(id, null); + @InlineMe(replacement = "this.smartrates(id, null)") + public final List getSmartrates(final String id) throws EasyPostException { + return this.smartrates(id, null); } /** @@ -453,8 +461,12 @@ public List getSmartrates(final String id) throws EasyPostException { * Deprecated: v5.5.0 - v7.0.0 */ @Deprecated - public SmartRate getLowestSmartRate(final List smartRates, int deliveryDay, String deliveryAccuracy) - throws EasyPostException { + @InlineMe(replacement = + "this.findLowestSmartrate(smartRates, deliveryDay, SmartrateAccuracy.getByKeyName(deliveryAccuracy))", + imports = "com.easypost.model.SmartrateAccuracy" + ) + public final SmartRate getLowestSmartRate(final List smartRates, + int deliveryDay, String deliveryAccuracy) throws EasyPostException { return findLowestSmartrate(smartRates, deliveryDay, SmartrateAccuracy.getByKeyName(deliveryAccuracy)); } diff --git a/src/main/java/com/easypost/utils/Utilities.java b/src/main/java/com/easypost/utils/Utilities.java index 849ad0a44..7cbbad66e 100644 --- a/src/main/java/com/easypost/utils/Utilities.java +++ b/src/main/java/com/easypost/utils/Utilities.java @@ -9,6 +9,7 @@ import com.easypost.model.SmartRate; import com.easypost.model.SmartrateAccuracy; import com.easypost.model.StatelessRate; +import com.google.errorprone.annotations.InlineMe; import java.util.List; import java.util.Map; @@ -151,6 +152,9 @@ public static Event validateWebhook(byte[] eventBody, Map header * Deprecated: v5.5.0 - v7.0.0 */ @Deprecated + @InlineMe(replacement = + "Utilities.findLowestSmartrate(smartrates, deliveryDay, SmartrateAccuracy.getByKeyName(deliveryAccuracy))", + imports = {"com.easypost.model.SmartrateAccuracy", "com.easypost.utils.Utilities"}) public static SmartRate getLowestSmartRate(final List smartrates, int deliveryDay, String deliveryAccuracy) throws EasyPostException { return findLowestSmartrate(smartrates, deliveryDay, SmartrateAccuracy.getByKeyName(deliveryAccuracy)); diff --git a/src/test/java/com/easypost/Fixtures.java b/src/test/java/com/easypost/Fixtures.java index 62e7c523e..cafae466f 100644 --- a/src/test/java/com/easypost/Fixtures.java +++ b/src/test/java/com/easypost/Fixtures.java @@ -6,6 +6,7 @@ import com.google.gson.reflect.TypeToken; import java.io.IOException; +import java.io.UncheckedIOException; import java.lang.reflect.Type; import java.nio.charset.Charset; import java.nio.charset.StandardCharsets; @@ -283,7 +284,7 @@ public static byte[] eventBytes() { data = Files.readAllLines(Paths.get(fullFilePath), StandardCharsets.UTF_8) .get(0).getBytes(Charset.defaultCharset()); } catch (IOException error) { - error.printStackTrace(); + throw new UncheckedIOException(error); } return data;