From b04eb98a118163af561ac89d630d869c832277a2 Mon Sep 17 00:00:00 2001 From: Joe Date: Thu, 20 Feb 2020 00:00:59 -0600 Subject: [PATCH] Issue #261: Horizon v1.0.0 compatibility - converting Int64 to String * Attribute offer_id in manage buy offer and manage sell offer operations. * Attribute offer_id in Trade effect. * Attribute id in Offer resource. * Attribute timestamp and trade_count in Trade Aggregation resource. --- .../stellar/sdk/ManageBuyOfferOperation.java | 22 +++++++++---------- .../stellar/sdk/ManageSellOfferOperation.java | 22 +++++++++---------- .../sdk/requests/OffersRequestBuilder.java | 2 +- .../TradeAggregationsRequestBuilder.java | 2 +- .../stellar/sdk/responses/OfferResponse.java | 6 ++--- .../responses/TradeAggregationResponse.java | 12 +++++----- .../effects/TradeEffectResponse.java | 15 ++++++++++--- .../ManageBuyOfferOperationResponse.java | 14 +++++++++--- .../ManageSellOfferOperationResponse.java | 14 +++++++++--- .../org/stellar/sdk/xdr/ManageBuyOfferOp.java | 18 +++++++++------ .../stellar/sdk/xdr/ManageBuyOfferResult.java | 2 +- .../stellar/sdk/xdr/ManageSellOfferOp.java | 18 +++++++++------ .../java/org/stellar/sdk/OperationTest.java | 8 +++---- 13 files changed, 94 insertions(+), 61 deletions(-) diff --git a/src/main/java/org/stellar/sdk/ManageBuyOfferOperation.java b/src/main/java/org/stellar/sdk/ManageBuyOfferOperation.java index 747609b8c..9cce2e1b6 100644 --- a/src/main/java/org/stellar/sdk/ManageBuyOfferOperation.java +++ b/src/main/java/org/stellar/sdk/ManageBuyOfferOperation.java @@ -17,9 +17,9 @@ public class ManageBuyOfferOperation extends Operation { private final Asset buying; private final String amount; private final String price; - private final long offerId; + private final String offerId; - private ManageBuyOfferOperation(Asset selling, Asset buying, String amount, String price, long offerId) { + private ManageBuyOfferOperation(Asset selling, Asset buying, String amount, String price, String offerId) { this.selling = checkNotNull(selling, "selling cannot be null"); this.buying = checkNotNull(buying, "buying cannot be null"); this.amount = checkNotNull(amount, "amount cannot be null"); @@ -59,7 +59,7 @@ public String getPrice() { /** * The ID of the offer. */ - public long getOfferId() { + public String getOfferId() { return offerId; } @@ -73,8 +73,8 @@ org.stellar.sdk.xdr.Operation.OperationBody toOperationBody() { op.setBuyAmount(amount); Price price = Price.fromString(this.price); op.setPrice(price.toXdr()); - Int64 offerId = new Int64(); - offerId.setInt64(Long.valueOf(this.offerId)); + String64 offerId = new String64(); + offerId.setString64(new XdrString(this.offerId)); op.setOfferID(offerId); org.stellar.sdk.xdr.Operation.OperationBody body = new org.stellar.sdk.xdr.Operation.OperationBody(); @@ -86,7 +86,7 @@ org.stellar.sdk.xdr.Operation.OperationBody toOperationBody() { /** * Builds ManageBuyOffer operation. If you want to update existing offer use - * {@link org.stellar.sdk.ManageBuyOfferOperation.Builder#setOfferId(long)}. + * {@link org.stellar.sdk.ManageBuyOfferOperation.Builder#setOfferId(String)}. * * @see ManageBuyOfferOperation */ @@ -96,7 +96,7 @@ public static class Builder { private final Asset buying; private final String amount; private final String price; - private long offerId = 0; + private String offerId = "0"; private String mSourceAccount; @@ -108,14 +108,14 @@ public static class Builder { Builder(ManageBuyOfferOp op) { selling = Asset.fromXdr(op.getSelling()); buying = Asset.fromXdr(op.getBuying()); - amount = Operation.fromXdrAmount(op.getBuyAmount().getInt64().longValue()); + amount = Operation.fromXdrAmount(op.getBuyAmount().getInt64()); price = Price.fromXdr(op.getPrice()).toString(); - offerId = op.getOfferID().getInt64().longValue(); + offerId = op.getOfferID().getString64().toString(); } /** * Creates a new ManageBuyOffer builder. If you want to update existing offer use - * {@link org.stellar.sdk.ManageBuyOfferOperation.Builder#setOfferId(long)}. + * {@link org.stellar.sdk.ManageBuyOfferOperation.Builder#setOfferId(String)}. * * @param selling The asset being sold in this operation * @param buying The asset being bought in this operation @@ -135,7 +135,7 @@ public Builder(Asset selling, Asset buying, String amount, String price) { * * @param offerId */ - public Builder setOfferId(long offerId) { + public Builder setOfferId(String offerId) { this.offerId = offerId; return this; } diff --git a/src/main/java/org/stellar/sdk/ManageSellOfferOperation.java b/src/main/java/org/stellar/sdk/ManageSellOfferOperation.java index 497ff0bff..0c1420f63 100644 --- a/src/main/java/org/stellar/sdk/ManageSellOfferOperation.java +++ b/src/main/java/org/stellar/sdk/ManageSellOfferOperation.java @@ -16,9 +16,9 @@ public class ManageSellOfferOperation extends Operation { private final Asset buying; private final String amount; private final String price; - private final long offerId; + private final String offerId; - private ManageSellOfferOperation(Asset selling, Asset buying, String amount, String price, long offerId) { + private ManageSellOfferOperation(Asset selling, Asset buying, String amount, String price, String offerId) { this.selling = checkNotNull(selling, "selling cannot be null"); this.buying = checkNotNull(buying, "buying cannot be null"); this.amount = checkNotNull(amount, "amount cannot be null"); @@ -58,7 +58,7 @@ public String getPrice() { /** * The ID of the offer. */ - public long getOfferId() { + public String getOfferId() { return offerId; } @@ -72,8 +72,8 @@ org.stellar.sdk.xdr.Operation.OperationBody toOperationBody() { op.setAmount(amount); Price price = Price.fromString(this.price); op.setPrice(price.toXdr()); - Int64 offerId = new Int64(); - offerId.setInt64(Long.valueOf(this.offerId)); + String64 offerId = new String64(); + offerId.setString64(new XdrString(this.offerId)); op.setOfferID(offerId); org.stellar.sdk.xdr.Operation.OperationBody body = new org.stellar.sdk.xdr.Operation.OperationBody(); @@ -85,7 +85,7 @@ org.stellar.sdk.xdr.Operation.OperationBody toOperationBody() { /** * Builds ManageSellOffer operation. If you want to update existing offer use - * {@link org.stellar.sdk.ManageSellOfferOperation.Builder#setOfferId(long)}. + * {@link org.stellar.sdk.ManageSellOfferOperation.Builder#setOfferId(String)}. * @see ManageSellOfferOperation */ public static class Builder { @@ -94,7 +94,7 @@ public static class Builder { private final Asset buying; private final String amount; private final String price; - private long offerId = 0; + private String offerId = "0"; private String mSourceAccount; @@ -105,14 +105,14 @@ public static class Builder { Builder(ManageSellOfferOp op) { selling = Asset.fromXdr(op.getSelling()); buying = Asset.fromXdr(op.getBuying()); - amount = Operation.fromXdrAmount(op.getAmount().getInt64().longValue()); + amount = Operation.fromXdrAmount(op.getAmount().getInt64()); price = Price.fromXdr(op.getPrice()).toString(); - offerId = op.getOfferID().getInt64().longValue(); + offerId = op.getOfferID().getString64().toString(); } /** * Creates a new ManageSellOffer builder. If you want to update existing offer use - * {@link org.stellar.sdk.ManageSellOfferOperation.Builder#setOfferId(long)}. + * {@link org.stellar.sdk.ManageSellOfferOperation.Builder#setOfferId(String)}. * @param selling The asset being sold in this operation * @param buying The asset being bought in this operation * @param amount Amount of selling being sold. @@ -130,7 +130,7 @@ public Builder(Asset selling, Asset buying, String amount, String price) { * Sets offer ID. 0 creates a new offer. Set to existing offer ID to change it. * @param offerId */ - public Builder setOfferId(long offerId) { + public Builder setOfferId(String offerId) { this.offerId = offerId; return this; } diff --git a/src/main/java/org/stellar/sdk/requests/OffersRequestBuilder.java b/src/main/java/org/stellar/sdk/requests/OffersRequestBuilder.java index b3e0a749c..686e1629f 100644 --- a/src/main/java/org/stellar/sdk/requests/OffersRequestBuilder.java +++ b/src/main/java/org/stellar/sdk/requests/OffersRequestBuilder.java @@ -135,7 +135,7 @@ public SSEStream stream(final EventListener listen * @throws IOException */ public Page execute() throws IOException, TooManyRequestsException { - return this.execute(this.httpClient, this.buildUri()); + return execute(this.httpClient, this.buildUri()); } @Override diff --git a/src/main/java/org/stellar/sdk/requests/TradeAggregationsRequestBuilder.java b/src/main/java/org/stellar/sdk/requests/TradeAggregationsRequestBuilder.java index ebe075074..6a5540741 100644 --- a/src/main/java/org/stellar/sdk/requests/TradeAggregationsRequestBuilder.java +++ b/src/main/java/org/stellar/sdk/requests/TradeAggregationsRequestBuilder.java @@ -56,6 +56,6 @@ public static Page execute(OkHttpClient httpClient, Ht } public Page execute() throws IOException, TooManyRequestsException { - return this.execute(this.httpClient, this.buildUri()); + return execute(this.httpClient, this.buildUri()); } } diff --git a/src/main/java/org/stellar/sdk/responses/OfferResponse.java b/src/main/java/org/stellar/sdk/responses/OfferResponse.java index 2a6ad200e..271201ec7 100644 --- a/src/main/java/org/stellar/sdk/responses/OfferResponse.java +++ b/src/main/java/org/stellar/sdk/responses/OfferResponse.java @@ -12,7 +12,7 @@ */ public class OfferResponse extends Response implements Pageable { @SerializedName("id") - private final Long id; + private final String id; @SerializedName("paging_token") private final String pagingToken; @SerializedName("seller") @@ -32,7 +32,7 @@ public class OfferResponse extends Response implements Pageable { @SerializedName("_links") private final Links links; - public OfferResponse(Long id, String pagingToken, String seller, Asset selling, Asset buying, String amount, String price, Integer lastModifiedLedger, String lastModifiedTime, Links links) { + public OfferResponse(String id, String pagingToken, String seller, Asset selling, Asset buying, String amount, String price, Integer lastModifiedLedger, String lastModifiedTime, Links links) { this.id = id; this.pagingToken = pagingToken; this.seller = seller; @@ -45,7 +45,7 @@ public OfferResponse(Long id, String pagingToken, String seller, Asset selling, this.links = links; } - public Long getId() { + public String getId() { return id; } diff --git a/src/main/java/org/stellar/sdk/responses/TradeAggregationResponse.java b/src/main/java/org/stellar/sdk/responses/TradeAggregationResponse.java index 08fc492d3..7c06d0985 100644 --- a/src/main/java/org/stellar/sdk/responses/TradeAggregationResponse.java +++ b/src/main/java/org/stellar/sdk/responses/TradeAggregationResponse.java @@ -6,9 +6,9 @@ public class TradeAggregationResponse extends Response { @SerializedName("timestamp") - private final long timestamp; + private final String timestamp; @SerializedName("trade_count") - private final int tradeCount; + private final String tradeCount; @SerializedName("base_volume") private final String baseVolume; @SerializedName("counter_volume") @@ -24,7 +24,7 @@ public class TradeAggregationResponse extends Response { @SerializedName("close") private final String close; - public TradeAggregationResponse(long timestamp, int tradeCount, String baseVolume, String counterVolume, String avg, String high, String low, String open, String close) { + public TradeAggregationResponse(String timestamp, String tradeCount, String baseVolume, String counterVolume, String avg, String high, String low, String open, String close) { this.timestamp = timestamp; this.tradeCount = tradeCount; this.baseVolume = baseVolume; @@ -36,15 +36,15 @@ public TradeAggregationResponse(long timestamp, int tradeCount, String baseVolum this.close = close; } - public long getTimestamp() { + public String getTimestamp() { return timestamp; } public Date getDate() { - return new Date(Long.valueOf(this.timestamp)); + return new Date(Long.parseLong(this.timestamp)); } - public int getTradeCount() { + public String getTradeCount() { return tradeCount; } diff --git a/src/main/java/org/stellar/sdk/responses/effects/TradeEffectResponse.java b/src/main/java/org/stellar/sdk/responses/effects/TradeEffectResponse.java index 15fe6e95c..4b8b25014 100644 --- a/src/main/java/org/stellar/sdk/responses/effects/TradeEffectResponse.java +++ b/src/main/java/org/stellar/sdk/responses/effects/TradeEffectResponse.java @@ -15,7 +15,7 @@ public class TradeEffectResponse extends EffectResponse { @SerializedName("seller") protected final String seller; @SerializedName("offer_id") - protected final Long offerId; + protected final String offerId; @SerializedName("sold_amount") protected final String soldAmount; @@ -35,7 +35,16 @@ public class TradeEffectResponse extends EffectResponse { @SerializedName("bought_asset_issuer") protected final String boughtAssetIssuer; - TradeEffectResponse(String seller, Long offerId, String soldAmount, String soldAssetType, String soldAssetCode, String soldAssetIssuer, String boughtAmount, String boughtAssetType, String boughtAssetCode, String boughtAssetIssuer) { + TradeEffectResponse(String seller, + String offerId, + String soldAmount, + String soldAssetType, + String soldAssetCode, + String soldAssetIssuer, + String boughtAmount, + String boughtAssetType, + String boughtAssetCode, + String boughtAssetIssuer) { this.seller = seller; this.offerId = offerId; this.soldAmount = soldAmount; @@ -52,7 +61,7 @@ public String getSeller() { return seller; } - public Long getOfferId() { + public String getOfferId() { return offerId; } diff --git a/src/main/java/org/stellar/sdk/responses/operations/ManageBuyOfferOperationResponse.java b/src/main/java/org/stellar/sdk/responses/operations/ManageBuyOfferOperationResponse.java index 186cf3f0a..94bb3c64b 100644 --- a/src/main/java/org/stellar/sdk/responses/operations/ManageBuyOfferOperationResponse.java +++ b/src/main/java/org/stellar/sdk/responses/operations/ManageBuyOfferOperationResponse.java @@ -12,7 +12,7 @@ */ public class ManageBuyOfferOperationResponse extends OperationResponse { @SerializedName("offer_id") - protected final Integer offerId; + protected final String offerId; @SerializedName("amount") protected final String amount; // Price is not implemented yet in horizon @@ -34,7 +34,15 @@ public class ManageBuyOfferOperationResponse extends OperationResponse { @SerializedName("selling_asset_issuer") protected final String sellingAssetIssuer; - ManageBuyOfferOperationResponse(Integer offerId, String amount, String price, String buyingAssetType, String buyingAssetCode, String buyingAssetIssuer, String sellingAssetType, String sellingAssetCode, String sellingAssetIssuer) { + ManageBuyOfferOperationResponse(String offerId, + String amount, + String price, + String buyingAssetType, + String buyingAssetCode, + String buyingAssetIssuer, + String sellingAssetType, + String sellingAssetCode, + String sellingAssetIssuer) { this.offerId = offerId; this.amount = amount; this.price = price; @@ -46,7 +54,7 @@ public class ManageBuyOfferOperationResponse extends OperationResponse { this.sellingAssetIssuer = sellingAssetIssuer; } - public Integer getOfferId() { + public String getOfferId() { return offerId; } diff --git a/src/main/java/org/stellar/sdk/responses/operations/ManageSellOfferOperationResponse.java b/src/main/java/org/stellar/sdk/responses/operations/ManageSellOfferOperationResponse.java index 0d5d7b90c..b292ccb5a 100644 --- a/src/main/java/org/stellar/sdk/responses/operations/ManageSellOfferOperationResponse.java +++ b/src/main/java/org/stellar/sdk/responses/operations/ManageSellOfferOperationResponse.java @@ -13,7 +13,7 @@ */ public class ManageSellOfferOperationResponse extends OperationResponse { @SerializedName("offer_id") - protected final Integer offerId; + protected final String offerId; @SerializedName("amount") protected final String amount; // Price is not implemented yet in horizon @@ -35,7 +35,15 @@ public class ManageSellOfferOperationResponse extends OperationResponse { @SerializedName("selling_asset_issuer") protected final String sellingAssetIssuer; - ManageSellOfferOperationResponse(Integer offerId, String amount, String price, String buyingAssetType, String buyingAssetCode, String buyingAssetIssuer, String sellingAssetType, String sellingAssetCode, String sellingAssetIssuer) { + ManageSellOfferOperationResponse(String offerId, + String amount, + String price, + String buyingAssetType, + String buyingAssetCode, + String buyingAssetIssuer, + String sellingAssetType, + String sellingAssetCode, + String sellingAssetIssuer) { this.offerId = offerId; this.amount = amount; this.price = price; @@ -47,7 +55,7 @@ public class ManageSellOfferOperationResponse extends OperationResponse { this.sellingAssetIssuer = sellingAssetIssuer; } - public Integer getOfferId() { + public String getOfferId() { return offerId; } diff --git a/src/main/java/org/stellar/sdk/xdr/ManageBuyOfferOp.java b/src/main/java/org/stellar/sdk/xdr/ManageBuyOfferOp.java index 980cc0662..ff62aa237 100644 --- a/src/main/java/org/stellar/sdk/xdr/ManageBuyOfferOp.java +++ b/src/main/java/org/stellar/sdk/xdr/ManageBuyOfferOp.java @@ -53,11 +53,11 @@ public Price getPrice() { public void setPrice(Price value) { this.price = value; } - private Int64 offerID; - public Int64 getOfferID() { + private String64 offerID; + public String64 getOfferID() { return this.offerID; } - public void setOfferID(Int64 value) { + public void setOfferID(String64 value) { this.offerID = value; } public static void encode(XdrDataOutputStream stream, ManageBuyOfferOp encodedManageBuyOfferOp) throws IOException{ @@ -65,7 +65,7 @@ public static void encode(XdrDataOutputStream stream, ManageBuyOfferOp encodedMa Asset.encode(stream, encodedManageBuyOfferOp.buying); Int64.encode(stream, encodedManageBuyOfferOp.buyAmount); Price.encode(stream, encodedManageBuyOfferOp.price); - Int64.encode(stream, encodedManageBuyOfferOp.offerID); + String64.encode(stream, encodedManageBuyOfferOp.offerID); } public void encode(XdrDataOutputStream stream) throws IOException { encode(stream, this); @@ -76,7 +76,7 @@ public static ManageBuyOfferOp decode(XdrDataInputStream stream) throws IOExcept decodedManageBuyOfferOp.buying = Asset.decode(stream); decodedManageBuyOfferOp.buyAmount = Int64.decode(stream); decodedManageBuyOfferOp.price = Price.decode(stream); - decodedManageBuyOfferOp.offerID = Int64.decode(stream); + decodedManageBuyOfferOp.offerID = String64.decode(stream); return decodedManageBuyOfferOp; } @Override @@ -85,11 +85,15 @@ public int hashCode() { } @Override public boolean equals(Object object) { - if (object == null || !(object instanceof ManageBuyOfferOp)) { + if (!(object instanceof ManageBuyOfferOp)) { return false; } ManageBuyOfferOp other = (ManageBuyOfferOp) object; - return Objects.equal(this.selling, other.selling) && Objects.equal(this.buying, other.buying) && Objects.equal(this.buyAmount, other.buyAmount) && Objects.equal(this.price, other.price) && Objects.equal(this.offerID, other.offerID); + return Objects.equal(this.selling, other.selling) + && Objects.equal(this.buying, other.buying) + && Objects.equal(this.buyAmount, other.buyAmount) + && Objects.equal(this.price, other.price) + && Objects.equal(this.offerID, other.offerID); } } diff --git a/src/main/java/org/stellar/sdk/xdr/ManageBuyOfferResult.java b/src/main/java/org/stellar/sdk/xdr/ManageBuyOfferResult.java index 8eafb0fb7..0d7ae8cf9 100644 --- a/src/main/java/org/stellar/sdk/xdr/ManageBuyOfferResult.java +++ b/src/main/java/org/stellar/sdk/xdr/ManageBuyOfferResult.java @@ -69,7 +69,7 @@ public int hashCode() { } @Override public boolean equals(Object object) { - if (object == null || !(object instanceof ManageBuyOfferResult)) { + if (!(object instanceof ManageBuyOfferResult)) { return false; } diff --git a/src/main/java/org/stellar/sdk/xdr/ManageSellOfferOp.java b/src/main/java/org/stellar/sdk/xdr/ManageSellOfferOp.java index 38796327d..c238b5a4d 100644 --- a/src/main/java/org/stellar/sdk/xdr/ManageSellOfferOp.java +++ b/src/main/java/org/stellar/sdk/xdr/ManageSellOfferOp.java @@ -52,11 +52,11 @@ public Price getPrice() { public void setPrice(Price value) { this.price = value; } - private Int64 offerID; - public Int64 getOfferID() { + private String64 offerID; + public String64 getOfferID() { return this.offerID; } - public void setOfferID(Int64 value) { + public void setOfferID(String64 value) { this.offerID = value; } public static void encode(XdrDataOutputStream stream, ManageSellOfferOp encodedManageSellOfferOp) throws IOException{ @@ -64,7 +64,7 @@ public static void encode(XdrDataOutputStream stream, ManageSellOfferOp encodedM Asset.encode(stream, encodedManageSellOfferOp.buying); Int64.encode(stream, encodedManageSellOfferOp.amount); Price.encode(stream, encodedManageSellOfferOp.price); - Int64.encode(stream, encodedManageSellOfferOp.offerID); + String64.encode(stream, encodedManageSellOfferOp.offerID); } public void encode(XdrDataOutputStream stream) throws IOException { encode(stream, this); @@ -75,7 +75,7 @@ public static ManageSellOfferOp decode(XdrDataInputStream stream) throws IOExcep decodedManageSellOfferOp.buying = Asset.decode(stream); decodedManageSellOfferOp.amount = Int64.decode(stream); decodedManageSellOfferOp.price = Price.decode(stream); - decodedManageSellOfferOp.offerID = Int64.decode(stream); + decodedManageSellOfferOp.offerID = String64.decode(stream); return decodedManageSellOfferOp; } @Override @@ -84,11 +84,15 @@ public int hashCode() { } @Override public boolean equals(Object object) { - if (object == null || !(object instanceof ManageSellOfferOp)) { + if (!(object instanceof ManageSellOfferOp)) { return false; } ManageSellOfferOp other = (ManageSellOfferOp) object; - return Objects.equal(this.selling, other.selling) && Objects.equal(this.buying, other.buying) && Objects.equal(this.amount, other.amount) && Objects.equal(this.price, other.price) && Objects.equal(this.offerID, other.offerID); + return Objects.equal(this.selling, other.selling) + && Objects.equal(this.buying, other.buying) + && Objects.equal(this.amount, other.amount) + && Objects.equal(this.price, other.price) + && Objects.equal(this.offerID, other.offerID); } } diff --git a/src/test/java/org/stellar/sdk/OperationTest.java b/src/test/java/org/stellar/sdk/OperationTest.java index 5a0800d9d..7b7dcf0cd 100644 --- a/src/test/java/org/stellar/sdk/OperationTest.java +++ b/src/test/java/org/stellar/sdk/OperationTest.java @@ -480,7 +480,7 @@ public void testManageSellOfferOperation() throws IOException, FormatException { String amount = "0.00001"; String price = "0.85334384"; // n=5333399 d=6250000 Price priceObj = Price.fromString(price); - long offerId = 1; + String offerId = "1"; ManageSellOfferOperation operation = new ManageSellOfferOperation.Builder(selling, buying, amount, price) .setOfferId(offerId) @@ -493,7 +493,7 @@ public void testManageSellOfferOperation() throws IOException, FormatException { assertEquals(100L, xdr.getBody().getManageSellOfferOp().getAmount().getInt64().longValue()); assertTrue(parsedOperation.getSelling() instanceof AssetTypeNative); assertTrue(parsedOperation.getBuying() instanceof AssetTypeCreditAlphaNum4); - assertTrue(parsedOperation.getBuying().equals(buying)); + assertEquals(parsedOperation.getBuying(), buying); assertEquals(amount, parsedOperation.getAmount()); assertEquals(price, parsedOperation.getPrice()); assertEquals(priceObj.getNumerator(), 5333399); @@ -517,7 +517,7 @@ public void testManageBuyOfferOperation() throws IOException, FormatException { String amount = "0.00001"; String price = "0.85334384"; // n=5333399 d=6250000 Price priceObj = Price.fromString(price); - long offerId = 1; + String offerId = "1"; ManageBuyOfferOperation operation = new ManageBuyOfferOperation.Builder(selling, buying, amount, price) .setOfferId(offerId) @@ -530,7 +530,7 @@ public void testManageBuyOfferOperation() throws IOException, FormatException { assertEquals(100L, xdr.getBody().getManageBuyOfferOp().getBuyAmount().getInt64().longValue()); assertTrue(parsedOperation.getSelling() instanceof AssetTypeNative); assertTrue(parsedOperation.getBuying() instanceof AssetTypeCreditAlphaNum4); - assertTrue(parsedOperation.getBuying().equals(buying)); + assertEquals(parsedOperation.getBuying(), buying); assertEquals(amount, parsedOperation.getAmount()); assertEquals(price, parsedOperation.getPrice()); assertEquals(priceObj.getNumerator(), 5333399);