Skip to content

Commit

Permalink
chore: improve test coverage.
Browse files Browse the repository at this point in the history
  • Loading branch information
overcat committed Aug 3, 2024
1 parent a8bea1e commit 64ae47b
Show file tree
Hide file tree
Showing 8 changed files with 168 additions and 95 deletions.
4 changes: 4 additions & 0 deletions src/test/java/org/stellar/sdk/MemoTest.java
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
package org.stellar.sdk;

import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;

import java.math.BigInteger;
import java.nio.charset.StandardCharsets;
import java.util.Arrays;
import org.junit.Test;
import org.stellar.sdk.xdr.MemoType;
Expand All @@ -23,6 +25,7 @@ public void testMemoTextSuccess() {
MemoText memo = Memo.text("test");
assertEquals(MemoType.MEMO_TEXT, memo.toXdr().getDiscriminant());
assertEquals("test", memo.getText());
assertArrayEquals("test".getBytes(StandardCharsets.UTF_8), memo.getBytes());
assertEquals("test", memo.toString());
}

Expand All @@ -31,6 +34,7 @@ public void testMemoTextUtf8() {
MemoText memo = Memo.text("三");
assertEquals(MemoType.MEMO_TEXT, memo.toXdr().getDiscriminant());
assertEquals("三", memo.getText());
assertArrayEquals("三".getBytes(StandardCharsets.UTF_8), memo.getBytes());
assertEquals("三", memo.toString());
}

Expand Down
159 changes: 102 additions & 57 deletions src/test/java/org/stellar/sdk/responses/EffectResponseTest.java

Large diffs are not rendered by default.

90 changes: 57 additions & 33 deletions src/test/java/org/stellar/sdk/responses/OperationResponseTest.java

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"paging_token": "151324471070908417-4",
"account": "GAHM22VLSTZHTY7RP64UYKG4VR7DDFGDGKJ4GVRRS77D7M6EMXG5XTNS",
"type": "account_sponsorship_updated",
"type_i": 62,
"type_i": 61,
"created_at": "2021-05-03T20:29:17Z",
"former_sponsor": "GA7PT6IPFVC4FGG273ZHGCNGG2O52F3B6CLVSI4SNIYOXLUNIOSFCK4F",
"new_sponsor": "GCZGSFPITKVJPJERJIVLCQK5YIHYTDXCY45ZHU3IRCUC53SXSCAL44JV"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"paging_token": "150803053451329538-3",
"account": "GANVXZ2DQ2FFLVCBSVMBBNVWSXS6YVEDP247EN4C3CM3I32XR4U3OU2I",
"type": "claimable_balance_sponsorship_updated",
"type_i": 71,
"type_i": 70,
"created_at": "2021-04-26T07:35:19Z",
"balance_id": "0000000016cbeff27945d389e9123231ec916f7bb848c0579ceca12e2bfab5c34ce0da24",
"former_sponsor": "GDDGK5C7UQWC7AEFZZVO7KXRXZVP2BBQJ2IQFAIROKME2O3XQR2CMVC7",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"paging_token": "3520511678095361-1",
"account": "GDDQTK5V3E3JFGLZZTJTKURTVY7QJPNQLTR5QS5HIWZWY5XPYIO5YELN",
"type": "data_sponsorship_updated",
"type_i": 68,
"type_i": 67,
"created_at": "2021-05-06T06:02:18Z",
"data_name": "hello",
"former_sponsor": "GDDQTK5V3E3JFGLZZTJTKURTVY7QJPNQLTR5QS5HIWZWY5XPYIO5YELN",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"paging_token": "150661624473337857-2",
"account": "GA26UJZUXR5Q2VMTJHAFS2DV6DKFRWBIN7JKDALGYFEXTRNGX5K6DEAZ",
"type": "signer_sponsorship_updated",
"type_i": 74,
"type_i": 73,
"created_at": "2021-04-24T06:13:09Z",
"signer": "GBIQ43HRJ3HKDRR3AYV25VYWQAQHZ7RWFBNUOU755FNY2O5UIFQD5TRD",
"former_sponsor": "GCZGSFPITKVJPJERJIVLCQK5YIHYTDXCY45ZHU3IRCUC53SXSCAL44JV",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"paging_token": "150671008977530881-2",
"account": "GB6JGOVUP3UXRPA2BUAUF6YGGZSRWQUMPTHVRSRATVYGFOYUYRPWJACK",
"type": "trustline_sponsorship_updated",
"type_i": 65,
"type_i": 64,
"created_at": "2021-04-24T09:29:50Z",
"asset_type": "credit_alphanum12",
"asset": "SQ0202:GCZODXV5HXRHHOZHWE57LMWIELKAXPKC64SOEBGTK7BV4GMRMOKYDIQQ",
Expand Down

0 comments on commit 64ae47b

Please sign in to comment.