From 5033902efc88374d1df8ea908cc6836cdbbf6729 Mon Sep 17 00:00:00 2001 From: Ivan Ivanov Date: Tue, 3 Dec 2024 10:01:31 +0200 Subject: [PATCH] test: Add tests for serialization/deserialization with no setters (#2117) Signed-off-by: Ivan Ivanov --- .../AccountAllowanceApproveTransactionTest.java | 8 ++++++++ .../AccountAllowanceDeleteTransactionTest.java | 9 ++++++++- .../sdk/AccountCreateTransactionTest.java | 8 ++++++++ .../sdk/AccountDeleteTransactionTest.java | 7 +++++++ .../sdk/AccountUpdateTransactionTest.java | 7 +++++++ .../sdk/ContractCreateTransactionTest.java | 7 +++++++ .../sdk/ContractDeleteTransactionTest.java | 7 +++++++ .../sdk/ContractExecuteTransactionTest.java | 7 +++++++ .../sdk/ContractUpdateTransactionTest.java | 7 +++++++ .../sdk/CryptoTransferTransactionTest.java | 7 +++++++ .../hashgraph/sdk/EthereumTransactionTest.java | 7 +++++++ .../hashgraph/sdk/FileAppendTransactionTest.java | 7 +++++++ .../hashgraph/sdk/FileCreateTransactionTest.java | 7 +++++++ .../hashgraph/sdk/FileDeleteTransactionTest.java | 7 +++++++ .../hashgraph/sdk/FileUpdateTransactionTest.java | 9 +++++++++ .../hashgraph/sdk/FreezeTransactionTest.java | 7 +++++++ .../sdk/LiveHashAddTransactionTest.java | 7 +++++++ .../sdk/LiveHashDeleteTransactionTest.java | 9 ++++++++- .../sdk/MessageSubmitTransactionTest.java | 7 +++++++ .../hashgraph/sdk/NodeCreateTransactionTest.java | 16 ++++++++-------- .../hashgraph/sdk/NodeDeleteTransactionTest.java | 7 +++++++ .../hashgraph/sdk/NodeUpdateTransactionTest.java | 4 ++-- .../sdk/ScheduleCreateTransactionTest.java | 7 +++++++ .../sdk/ScheduleDeleteTransactionTest.java | 7 +++++++ .../sdk/ScheduleSignTransactionTest.java | 7 +++++++ .../sdk/SystemDeleteTransactionTest.java | 7 +++++++ .../sdk/SystemUndeleteTransactionTest.java | 7 +++++++ .../sdk/TokenAirdropTransactionTest.java | 7 +++++++ .../sdk/TokenAssociateTransactionTest.java | 7 +++++++ .../hashgraph/sdk/TokenBurnTransactionTest.java | 7 +++++++ .../sdk/TokenCancelAirdropTransactionTest.java | 9 ++++++++- .../sdk/TokenClaimAirdropTransactionTest.java | 8 ++++++++ .../sdk/TokenCreateTransactionTest.java | 7 +++++++ .../sdk/TokenDeleteTransactionTest.java | 7 +++++++ .../sdk/TokenDissociateTransactionTest.java | 7 +++++++ .../TokenFeeScheduleUpdateTransactionTest.java | 7 +++++++ .../sdk/TokenFreezeTransactionTest.java | 7 +++++++ .../sdk/TokenGrantKycTransactionTest.java | 7 +++++++ .../hashgraph/sdk/TokenMintTransactionTest.java | 7 +++++++ .../hashgraph/sdk/TokenPauseTransactionTest.java | 9 ++++++++- .../sdk/TokenRejectTransactionTest.java | 7 +++++++ .../sdk/TokenRevokeKycTransactionTest.java | 7 +++++++ .../sdk/TokenUnfreezeTransactionTest.java | 7 +++++++ .../sdk/TokenUnpauseTransactionTest.java | 7 +++++++ .../sdk/TokenUpdateNftsTransactionTest.java | 7 +++++++ .../sdk/TokenUpdateTransactionTest.java | 7 +++++++ .../hashgraph/sdk/TokenWipeTransactionTest.java | 7 +++++++ .../sdk/TopicCreateTransactionTest.java | 7 +++++++ .../sdk/TopicDeleteTransactionTest.java | 6 ++++++ .../sdk/TopicMessageSubmitTransactionTest.java | 7 +++++++ .../sdk/TopicUpdateTransactionTest.java | 7 ++++++- 51 files changed, 360 insertions(+), 15 deletions(-) diff --git a/sdk/src/test/java/com/hedera/hashgraph/sdk/AccountAllowanceApproveTransactionTest.java b/sdk/src/test/java/com/hedera/hashgraph/sdk/AccountAllowanceApproveTransactionTest.java index ada2e8804..5d325cb87 100644 --- a/sdk/src/test/java/com/hedera/hashgraph/sdk/AccountAllowanceApproveTransactionTest.java +++ b/sdk/src/test/java/com/hedera/hashgraph/sdk/AccountAllowanceApproveTransactionTest.java @@ -103,6 +103,14 @@ void propertiesTest() { assertThat(tx.getTokenNftApprovals()).isNotEmpty(); } + @Test + void shouldBytesNoSetters() throws Exception { + var tx = new AccountAllowanceApproveTransaction(); + var tx2 = AccountAllowanceApproveTransaction.fromBytes(tx.toBytes()); + assertThat(tx2.toString()).isEqualTo(tx.toString()); + } + + @Test void fromScheduledTransaction() { var transactionBody = SchedulableTransactionBody.newBuilder() diff --git a/sdk/src/test/java/com/hedera/hashgraph/sdk/AccountAllowanceDeleteTransactionTest.java b/sdk/src/test/java/com/hedera/hashgraph/sdk/AccountAllowanceDeleteTransactionTest.java index d8f21eab6..44bd40cb7 100644 --- a/sdk/src/test/java/com/hedera/hashgraph/sdk/AccountAllowanceDeleteTransactionTest.java +++ b/sdk/src/test/java/com/hedera/hashgraph/sdk/AccountAllowanceDeleteTransactionTest.java @@ -71,7 +71,14 @@ void shouldSerialize() { @Test void shouldBytes() throws Exception { var tx = spawnTestTransaction(); - var tx2 = AccountAllowanceApproveTransaction.fromBytes(tx.toBytes()); + var tx2 = AccountAllowanceDeleteTransaction.fromBytes(tx.toBytes()); + assertThat(tx2.toString()).isEqualTo(tx.toString()); + } + + @Test + void shouldBytesNoSetters() throws Exception { + var tx = new AccountAllowanceDeleteTransaction(); + var tx2 = Transaction.fromBytes(tx.toBytes()); assertThat(tx2.toString()).isEqualTo(tx.toString()); } diff --git a/sdk/src/test/java/com/hedera/hashgraph/sdk/AccountCreateTransactionTest.java b/sdk/src/test/java/com/hedera/hashgraph/sdk/AccountCreateTransactionTest.java index a997f9b3c..23f1dee89 100644 --- a/sdk/src/test/java/com/hedera/hashgraph/sdk/AccountCreateTransactionTest.java +++ b/sdk/src/test/java/com/hedera/hashgraph/sdk/AccountCreateTransactionTest.java @@ -107,6 +107,14 @@ void shouldBytes2() throws Exception { assertThat(tx2.toString()).isEqualTo(tx.toString()); } + @Test + void shouldBytesNoSetters() throws Exception { + var tx = new AccountCreateTransaction(); + var tx2 = Transaction.fromBytes(tx.toBytes()); + assertThat(tx2.toString()).isEqualTo(tx.toString()); + } + + @Test void propertiesTest() { var tx = spawnTestTransaction(); diff --git a/sdk/src/test/java/com/hedera/hashgraph/sdk/AccountDeleteTransactionTest.java b/sdk/src/test/java/com/hedera/hashgraph/sdk/AccountDeleteTransactionTest.java index a9ad9c4e3..12148ec8b 100644 --- a/sdk/src/test/java/com/hedera/hashgraph/sdk/AccountDeleteTransactionTest.java +++ b/sdk/src/test/java/com/hedera/hashgraph/sdk/AccountDeleteTransactionTest.java @@ -72,6 +72,13 @@ void shouldBytes() throws Exception { assertThat(tx2.toString()).isEqualTo(tx.toString()); } + @Test + void shouldBytesNoSetters() throws Exception { + var tx = new AccountDeleteTransaction(); + var tx2 = Transaction.fromBytes(tx.toBytes()); + assertThat(tx2.toString()).isEqualTo(tx.toString()); + } + @Test void fromScheduledTransaction() { var transactionBody = SchedulableTransactionBody.newBuilder() diff --git a/sdk/src/test/java/com/hedera/hashgraph/sdk/AccountUpdateTransactionTest.java b/sdk/src/test/java/com/hedera/hashgraph/sdk/AccountUpdateTransactionTest.java index 06af2f055..8e6f4655d 100644 --- a/sdk/src/test/java/com/hedera/hashgraph/sdk/AccountUpdateTransactionTest.java +++ b/sdk/src/test/java/com/hedera/hashgraph/sdk/AccountUpdateTransactionTest.java @@ -96,6 +96,13 @@ void shouldBytes() throws Exception { assertThat(tx2.toString()).isEqualTo(tx.toString()); } + @Test + void shouldBytesNoSetters() throws Exception { + var tx = new AccountUpdateTransaction(); + var tx2 = Transaction.fromBytes(tx.toBytes()); + assertThat(tx2.toString()).isEqualTo(tx.toString()); + } + @Test void shouldSerialize2() { SnapshotMatcher.expect(spawnTestTransaction2().toString()).toMatchSnapshot(); diff --git a/sdk/src/test/java/com/hedera/hashgraph/sdk/ContractCreateTransactionTest.java b/sdk/src/test/java/com/hedera/hashgraph/sdk/ContractCreateTransactionTest.java index d044aa21b..363174ce1 100644 --- a/sdk/src/test/java/com/hedera/hashgraph/sdk/ContractCreateTransactionTest.java +++ b/sdk/src/test/java/com/hedera/hashgraph/sdk/ContractCreateTransactionTest.java @@ -63,6 +63,13 @@ void shouldSerialize2() { ).toMatchSnapshot(); } + @Test + void shouldBytesNoSetters() throws Exception { + var tx = new ContractCreateTransaction(); + var tx2 = Transaction.fromBytes(tx.toBytes()); + assertThat(tx2.toString()).isEqualTo(tx.toString()); + } + private ContractCreateTransaction spawnTestTransaction() { return new ContractCreateTransaction() .setNodeAccountIds(Arrays.asList(AccountId.fromString("0.0.5005"), AccountId.fromString("0.0.5006"))) diff --git a/sdk/src/test/java/com/hedera/hashgraph/sdk/ContractDeleteTransactionTest.java b/sdk/src/test/java/com/hedera/hashgraph/sdk/ContractDeleteTransactionTest.java index 841be3025..f6f7d6f1f 100644 --- a/sdk/src/test/java/com/hedera/hashgraph/sdk/ContractDeleteTransactionTest.java +++ b/sdk/src/test/java/com/hedera/hashgraph/sdk/ContractDeleteTransactionTest.java @@ -73,6 +73,13 @@ void shouldBytes() throws Exception { assertThat(tx2.toString()).isEqualTo(tx.toString()); } + @Test + void shouldBytesNoSetters() throws Exception { + var tx = new ContractDeleteTransaction(); + var tx2 = Transaction.fromBytes(tx.toBytes()); + assertThat(tx2.toString()).isEqualTo(tx.toString()); + } + @Test void fromScheduledTransaction() { var transactionBody = SchedulableTransactionBody.newBuilder() diff --git a/sdk/src/test/java/com/hedera/hashgraph/sdk/ContractExecuteTransactionTest.java b/sdk/src/test/java/com/hedera/hashgraph/sdk/ContractExecuteTransactionTest.java index 7912f01c4..4dc337c48 100644 --- a/sdk/src/test/java/com/hedera/hashgraph/sdk/ContractExecuteTransactionTest.java +++ b/sdk/src/test/java/com/hedera/hashgraph/sdk/ContractExecuteTransactionTest.java @@ -55,6 +55,13 @@ void shouldSerialize() { ).toMatchSnapshot(); } + @Test + void shouldBytesNoSetters() throws Exception { + var tx = new ContractExecuteTransaction(); + var tx2 = Transaction.fromBytes(tx.toBytes()); + assertThat(tx2.toString()).isEqualTo(tx.toString()); + } + private ContractExecuteTransaction spawnTestTransaction() { return new ContractExecuteTransaction() .setNodeAccountIds(Arrays.asList(AccountId.fromString("0.0.5005"), AccountId.fromString("0.0.5006"))) diff --git a/sdk/src/test/java/com/hedera/hashgraph/sdk/ContractUpdateTransactionTest.java b/sdk/src/test/java/com/hedera/hashgraph/sdk/ContractUpdateTransactionTest.java index f16c49e0a..e74b165ab 100644 --- a/sdk/src/test/java/com/hedera/hashgraph/sdk/ContractUpdateTransactionTest.java +++ b/sdk/src/test/java/com/hedera/hashgraph/sdk/ContractUpdateTransactionTest.java @@ -62,6 +62,13 @@ void shouldSerialize2() { ).toMatchSnapshot(); } + @Test + void shouldBytesNoSetters() throws Exception { + var tx = new ContractUpdateTransaction(); + var tx2 = Transaction.fromBytes(tx.toBytes()); + assertThat(tx2.toString()).isEqualTo(tx.toString()); + } + private ContractUpdateTransaction spawnTestTransaction() { return new ContractUpdateTransaction() .setNodeAccountIds(Arrays.asList(AccountId.fromString("0.0.5005"), AccountId.fromString("0.0.5006"))) diff --git a/sdk/src/test/java/com/hedera/hashgraph/sdk/CryptoTransferTransactionTest.java b/sdk/src/test/java/com/hedera/hashgraph/sdk/CryptoTransferTransactionTest.java index e9d673352..784d71452 100644 --- a/sdk/src/test/java/com/hedera/hashgraph/sdk/CryptoTransferTransactionTest.java +++ b/sdk/src/test/java/com/hedera/hashgraph/sdk/CryptoTransferTransactionTest.java @@ -57,6 +57,13 @@ void shouldSerialize() { ).toMatchSnapshot(); } + @Test + void shouldBytesNoSetters() throws Exception { + var tx = new TransferTransaction(); + var tx2 = Transaction.fromBytes(tx.toBytes()); + assertThat(tx2.toString()).isEqualTo(tx.toString()); + } + private TransferTransaction spawnTestTransaction() { return new TransferTransaction() .setNodeAccountIds(Arrays.asList(AccountId.fromString("0.0.5005"), AccountId.fromString("0.0.5006"))) diff --git a/sdk/src/test/java/com/hedera/hashgraph/sdk/EthereumTransactionTest.java b/sdk/src/test/java/com/hedera/hashgraph/sdk/EthereumTransactionTest.java index baa8144b9..bc817b0ba 100644 --- a/sdk/src/test/java/com/hedera/hashgraph/sdk/EthereumTransactionTest.java +++ b/sdk/src/test/java/com/hedera/hashgraph/sdk/EthereumTransactionTest.java @@ -39,6 +39,13 @@ EthereumTransaction spawnTestTransaction() { .sign(unusedPrivateKey); } + @Test + void shouldBytesNoSetters() throws Exception { + var tx = new EthereumTransaction(); + var tx2 = Transaction.fromBytes(tx.toBytes()); + assertThat(tx2.toString()).isEqualTo(tx.toString()); + } + @Test void shouldSerialize() { SnapshotMatcher.expect(spawnTestTransaction() diff --git a/sdk/src/test/java/com/hedera/hashgraph/sdk/FileAppendTransactionTest.java b/sdk/src/test/java/com/hedera/hashgraph/sdk/FileAppendTransactionTest.java index c7be96651..cec89ef1e 100644 --- a/sdk/src/test/java/com/hedera/hashgraph/sdk/FileAppendTransactionTest.java +++ b/sdk/src/test/java/com/hedera/hashgraph/sdk/FileAppendTransactionTest.java @@ -117,6 +117,13 @@ private FileAppendTransaction spawnTestTransaction(List accountIds) { .sign(unusedPrivateKey); } + @Test + void shouldBytesNoSetters() throws Exception { + var tx = new FileAppendTransaction(); + var tx2 = Transaction.fromBytes(tx.toBytes()); + assertThat(tx2.toString()).isEqualTo(tx.toString()); + } + @Test void shouldSerializeBigContents() { var nodeAccountIds = new ArrayList(); diff --git a/sdk/src/test/java/com/hedera/hashgraph/sdk/FileCreateTransactionTest.java b/sdk/src/test/java/com/hedera/hashgraph/sdk/FileCreateTransactionTest.java index d7e8208b7..45b4c4ea1 100644 --- a/sdk/src/test/java/com/hedera/hashgraph/sdk/FileCreateTransactionTest.java +++ b/sdk/src/test/java/com/hedera/hashgraph/sdk/FileCreateTransactionTest.java @@ -54,6 +54,13 @@ void shouldSerialize() { ).toMatchSnapshot(); } + @Test + void shouldBytesNoSetters() throws Exception { + var tx = new FileCreateTransaction(); + var tx2 = Transaction.fromBytes(tx.toBytes()); + assertThat(tx2.toString()).isEqualTo(tx.toString()); + } + private FileCreateTransaction spawnTestTransaction() { return new FileCreateTransaction() .setNodeAccountIds(Arrays.asList(AccountId.fromString("0.0.5005"), AccountId.fromString("0.0.5006"))) diff --git a/sdk/src/test/java/com/hedera/hashgraph/sdk/FileDeleteTransactionTest.java b/sdk/src/test/java/com/hedera/hashgraph/sdk/FileDeleteTransactionTest.java index 2a40687f9..437ecb270 100644 --- a/sdk/src/test/java/com/hedera/hashgraph/sdk/FileDeleteTransactionTest.java +++ b/sdk/src/test/java/com/hedera/hashgraph/sdk/FileDeleteTransactionTest.java @@ -54,6 +54,13 @@ void shouldSerialize() { ).toMatchSnapshot(); } + @Test + void shouldBytesNoSetters() throws Exception { + var tx = new FileDeleteTransaction(); + var tx2 = Transaction.fromBytes(tx.toBytes()); + assertThat(tx2.toString()).isEqualTo(tx.toString()); + } + private FileDeleteTransaction spawnTestTransaction() { return new FileDeleteTransaction() .setNodeAccountIds(Arrays.asList(AccountId.fromString("0.0.5005"), AccountId.fromString("0.0.5006"))) diff --git a/sdk/src/test/java/com/hedera/hashgraph/sdk/FileUpdateTransactionTest.java b/sdk/src/test/java/com/hedera/hashgraph/sdk/FileUpdateTransactionTest.java index 70fba11b0..31a32ae71 100644 --- a/sdk/src/test/java/com/hedera/hashgraph/sdk/FileUpdateTransactionTest.java +++ b/sdk/src/test/java/com/hedera/hashgraph/sdk/FileUpdateTransactionTest.java @@ -75,6 +75,15 @@ void shouldBytes() throws Exception { assertThat(tx2.toString()).isEqualTo(tx.toString()); } + + @Test + void shouldBytesNoSetters() throws Exception { + var tx = new FileUpdateTransaction(); + var tx2 = Transaction.fromBytes(tx.toBytes()); + assertThat(tx2.toString()).isEqualTo(tx.toString()); + } + + @Test void fromScheduledTransaction() { var transactionBody = SchedulableTransactionBody.newBuilder() diff --git a/sdk/src/test/java/com/hedera/hashgraph/sdk/FreezeTransactionTest.java b/sdk/src/test/java/com/hedera/hashgraph/sdk/FreezeTransactionTest.java index 51e1daf61..ec1410084 100644 --- a/sdk/src/test/java/com/hedera/hashgraph/sdk/FreezeTransactionTest.java +++ b/sdk/src/test/java/com/hedera/hashgraph/sdk/FreezeTransactionTest.java @@ -77,6 +77,13 @@ void shouldBytes() throws Exception { assertThat(tx2.toString()).isEqualTo(tx.toString()); } + @Test + void shouldBytesNoSetters() throws Exception { + var tx = new FreezeTransaction(); + var tx2 = Transaction.fromBytes(tx.toBytes()); + assertThat(tx2.toString()).isEqualTo(tx.toString()); + } + @Test void fromScheduledTransaction() { var transactionBody = SchedulableTransactionBody.newBuilder() diff --git a/sdk/src/test/java/com/hedera/hashgraph/sdk/LiveHashAddTransactionTest.java b/sdk/src/test/java/com/hedera/hashgraph/sdk/LiveHashAddTransactionTest.java index d27509851..180cb1879 100644 --- a/sdk/src/test/java/com/hedera/hashgraph/sdk/LiveHashAddTransactionTest.java +++ b/sdk/src/test/java/com/hedera/hashgraph/sdk/LiveHashAddTransactionTest.java @@ -48,6 +48,13 @@ private LiveHashAddTransaction spawnTestTransaction() { .sign(privateKey); } + @Test + void shouldBytesNoSetters() throws Exception { + var tx = new LiveHashAddTransaction(); + var tx2 = Transaction.fromBytes(tx.toBytes()); + assertThat(tx2.toString()).isEqualTo(tx.toString()); + } + @Test void shouldBytes() throws Exception { var tx = spawnTestTransaction(); diff --git a/sdk/src/test/java/com/hedera/hashgraph/sdk/LiveHashDeleteTransactionTest.java b/sdk/src/test/java/com/hedera/hashgraph/sdk/LiveHashDeleteTransactionTest.java index ed687d7f2..1fc0a7a86 100644 --- a/sdk/src/test/java/com/hedera/hashgraph/sdk/LiveHashDeleteTransactionTest.java +++ b/sdk/src/test/java/com/hedera/hashgraph/sdk/LiveHashDeleteTransactionTest.java @@ -48,7 +48,14 @@ private LiveHashDeleteTransaction spawnTestTransaction() { @Test void shouldBytes() throws Exception { var tx = spawnTestTransaction(); - var tx2 = LiveHashAddTransaction.fromBytes(tx.toBytes()); + var tx2 = LiveHashDeleteTransaction.fromBytes(tx.toBytes()); assertThat(tx2).hasToString(tx.toString()); } + + @Test + void shouldBytesNoSetters() throws Exception { + var tx = new LiveHashDeleteTransaction(); + var tx2 = Transaction.fromBytes(tx.toBytes()); + assertThat(tx2.toString()).isEqualTo(tx.toString()); + } } diff --git a/sdk/src/test/java/com/hedera/hashgraph/sdk/MessageSubmitTransactionTest.java b/sdk/src/test/java/com/hedera/hashgraph/sdk/MessageSubmitTransactionTest.java index 187b0ecb9..390bffa9d 100644 --- a/sdk/src/test/java/com/hedera/hashgraph/sdk/MessageSubmitTransactionTest.java +++ b/sdk/src/test/java/com/hedera/hashgraph/sdk/MessageSubmitTransactionTest.java @@ -54,6 +54,13 @@ void shouldBytes() throws Exception { assertThat(tx2.toString()).isEqualTo(tx.toString()); } + @Test + void shouldBytesNoSetters() throws Exception { + var tx = new TopicMessageSubmitTransaction(); + var tx2 = Transaction.fromBytes(tx.toBytes()); + assertThat(tx2.toString()).isEqualTo(tx.toString()); + } + @Test void shouldSerialize() { SnapshotMatcher.expect(spawnTestTransaction() diff --git a/sdk/src/test/java/com/hedera/hashgraph/sdk/NodeCreateTransactionTest.java b/sdk/src/test/java/com/hedera/hashgraph/sdk/NodeCreateTransactionTest.java index af814fb1f..b08f4f90b 100644 --- a/sdk/src/test/java/com/hedera/hashgraph/sdk/NodeCreateTransactionTest.java +++ b/sdk/src/test/java/com/hedera/hashgraph/sdk/NodeCreateTransactionTest.java @@ -122,6 +122,14 @@ void fromScheduledTransaction() { assertThat(tx).isInstanceOf(NodeCreateTransaction.class); } + + @Test + void shouldBytesNoSetters() throws Exception { + var tx = new NodeCreateTransaction(); + var tx2 = Transaction.fromBytes(tx.toBytes()); + assertThat(tx2.toString()).isEqualTo(tx.toString()); + } + @Test void testUnrecognizedServicePort() throws Exception { var tx = new NodeCreateTransaction() @@ -134,13 +142,6 @@ void testUnrecognizedServicePort() throws Exception { assertThat(tx2.toString()).isEqualTo(tx.toString()); } - @Test - void testNullOptionalValues() throws Exception { - var tx = new NodeCreateTransaction(); - var tx2 = NodeCreateTransaction.fromBytes(tx.toBytes()); - assertThat(tx2.toString()).isEqualTo(tx.toString()); - } - @Test void testSetNull() { new NodeCreateTransaction() @@ -151,7 +152,6 @@ void testSetNull() { .setAdminKey(null); } - @Test void constructNodeCreateTransactionFromTransactionBodyProtobuf() { var transactionBodyBuilder = NodeCreateTransactionBody.newBuilder(); diff --git a/sdk/src/test/java/com/hedera/hashgraph/sdk/NodeDeleteTransactionTest.java b/sdk/src/test/java/com/hedera/hashgraph/sdk/NodeDeleteTransactionTest.java index 67ea54004..9aff4aaf7 100644 --- a/sdk/src/test/java/com/hedera/hashgraph/sdk/NodeDeleteTransactionTest.java +++ b/sdk/src/test/java/com/hedera/hashgraph/sdk/NodeDeleteTransactionTest.java @@ -74,6 +74,13 @@ void shouldBytes() throws Exception { assertThat(tx2.toString()).isEqualTo(tx.toString()); } + @Test + void shouldBytesNoSetters() throws Exception { + var tx = new NodeDeleteTransaction(); + var tx2 = Transaction.fromBytes(tx.toBytes()); + assertThat(tx2.toString()).isEqualTo(tx.toString()); + } + @Test void fromScheduledTransaction() { var transactionBody = SchedulableTransactionBody.newBuilder() diff --git a/sdk/src/test/java/com/hedera/hashgraph/sdk/NodeUpdateTransactionTest.java b/sdk/src/test/java/com/hedera/hashgraph/sdk/NodeUpdateTransactionTest.java index e79f6e156..3ce37b29d 100644 --- a/sdk/src/test/java/com/hedera/hashgraph/sdk/NodeUpdateTransactionTest.java +++ b/sdk/src/test/java/com/hedera/hashgraph/sdk/NodeUpdateTransactionTest.java @@ -118,9 +118,9 @@ void shouldBytes() throws Exception { } @Test - void testNullOptionalValues() throws Exception { + void shouldBytesNoSetters() throws Exception { var tx = new NodeUpdateTransaction(); - var tx2 = NodeUpdateTransaction.fromBytes(tx.toBytes()); + var tx2 = Transaction.fromBytes(tx.toBytes()); assertThat(tx2.toString()).isEqualTo(tx.toString()); } diff --git a/sdk/src/test/java/com/hedera/hashgraph/sdk/ScheduleCreateTransactionTest.java b/sdk/src/test/java/com/hedera/hashgraph/sdk/ScheduleCreateTransactionTest.java index ff055cce1..2eae10a1f 100644 --- a/sdk/src/test/java/com/hedera/hashgraph/sdk/ScheduleCreateTransactionTest.java +++ b/sdk/src/test/java/com/hedera/hashgraph/sdk/ScheduleCreateTransactionTest.java @@ -75,4 +75,11 @@ void shouldBytes() throws Exception { var tx2 = ScheduleCreateTransaction.fromBytes(tx.toBytes()); assertThat(tx2.toString()).isEqualTo(tx.toString()); } + + @Test + void shouldBytesNoSetters() throws Exception { + var tx = new ScheduleCreateTransaction(); + var tx2 = Transaction.fromBytes(tx.toBytes()); + assertThat(tx2.toString()).isEqualTo(tx.toString()); + } } diff --git a/sdk/src/test/java/com/hedera/hashgraph/sdk/ScheduleDeleteTransactionTest.java b/sdk/src/test/java/com/hedera/hashgraph/sdk/ScheduleDeleteTransactionTest.java index d9eed28d1..9d61c9c15 100644 --- a/sdk/src/test/java/com/hedera/hashgraph/sdk/ScheduleDeleteTransactionTest.java +++ b/sdk/src/test/java/com/hedera/hashgraph/sdk/ScheduleDeleteTransactionTest.java @@ -71,6 +71,13 @@ void shouldBytes() throws Exception { assertThat(tx2.toString()).isEqualTo(tx.toString()); } + @Test + void shouldBytesNoSetters() throws Exception { + var tx = new ScheduleDeleteTransaction(); + var tx2 = Transaction.fromBytes(tx.toBytes()); + assertThat(tx2.toString()).isEqualTo(tx.toString()); + } + @Test void fromScheduledTransaction() { var transactionBody = SchedulableTransactionBody.newBuilder() diff --git a/sdk/src/test/java/com/hedera/hashgraph/sdk/ScheduleSignTransactionTest.java b/sdk/src/test/java/com/hedera/hashgraph/sdk/ScheduleSignTransactionTest.java index 6c987f231..6a98e11a6 100644 --- a/sdk/src/test/java/com/hedera/hashgraph/sdk/ScheduleSignTransactionTest.java +++ b/sdk/src/test/java/com/hedera/hashgraph/sdk/ScheduleSignTransactionTest.java @@ -52,6 +52,13 @@ void shouldSerialize() { ).toMatchSnapshot(); } + @Test + void shouldBytesNoSetters() throws Exception { + var tx = new ScheduleSignTransaction(); + var tx2 = Transaction.fromBytes(tx.toBytes()); + assertThat(tx2.toString()).isEqualTo(tx.toString()); + } + private ScheduleSignTransaction spawnTestTransaction() { return new ScheduleSignTransaction() .setNodeAccountIds(Arrays.asList(AccountId.fromString("0.0.5005"), AccountId.fromString("0.0.5006"))) diff --git a/sdk/src/test/java/com/hedera/hashgraph/sdk/SystemDeleteTransactionTest.java b/sdk/src/test/java/com/hedera/hashgraph/sdk/SystemDeleteTransactionTest.java index b65c7dfca..8020fb58e 100644 --- a/sdk/src/test/java/com/hedera/hashgraph/sdk/SystemDeleteTransactionTest.java +++ b/sdk/src/test/java/com/hedera/hashgraph/sdk/SystemDeleteTransactionTest.java @@ -72,6 +72,13 @@ void shouldSerializeContract() { SnapshotMatcher.expect(spawnTestTransactionContract().toString()).toMatchSnapshot(); } + @Test + void shouldBytesNoSetters() throws Exception { + var tx = new SystemDeleteTransaction(); + var tx2 = Transaction.fromBytes(tx.toBytes()); + assertThat(tx2.toString()).isEqualTo(tx.toString()); + } + private SystemDeleteTransaction spawnTestTransactionContract() { return new SystemDeleteTransaction().setNodeAccountIds( Arrays.asList(AccountId.fromString("0.0.5005"), AccountId.fromString("0.0.5006"))) diff --git a/sdk/src/test/java/com/hedera/hashgraph/sdk/SystemUndeleteTransactionTest.java b/sdk/src/test/java/com/hedera/hashgraph/sdk/SystemUndeleteTransactionTest.java index 965d07aef..7f29d55d8 100644 --- a/sdk/src/test/java/com/hedera/hashgraph/sdk/SystemUndeleteTransactionTest.java +++ b/sdk/src/test/java/com/hedera/hashgraph/sdk/SystemUndeleteTransactionTest.java @@ -54,6 +54,13 @@ void shouldSerializeFile() { ).toMatchSnapshot(); } + @Test + void shouldBytesNoSetters() throws Exception { + var tx = new SystemUndeleteTransaction(); + var tx2 = Transaction.fromBytes(tx.toBytes()); + assertThat(tx2.toString()).isEqualTo(tx.toString()); + } + private SystemUndeleteTransaction spawnTestTransactionFile() { return new SystemUndeleteTransaction() .setNodeAccountIds(Arrays.asList(AccountId.fromString("0.0.5005"), AccountId.fromString("0.0.5006"))) diff --git a/sdk/src/test/java/com/hedera/hashgraph/sdk/TokenAirdropTransactionTest.java b/sdk/src/test/java/com/hedera/hashgraph/sdk/TokenAirdropTransactionTest.java index e0708b937..f0389ce68 100644 --- a/sdk/src/test/java/com/hedera/hashgraph/sdk/TokenAirdropTransactionTest.java +++ b/sdk/src/test/java/com/hedera/hashgraph/sdk/TokenAirdropTransactionTest.java @@ -67,6 +67,13 @@ void shouldSerialize() { ).toMatchSnapshot(); } + @Test + void shouldBytesNoSetters() throws Exception { + var tx = new TokenAirdropTransaction(); + var tx2 = Transaction.fromBytes(tx.toBytes()); + assertThat(tx2.toString()).isEqualTo(tx.toString()); + } + private TokenAirdropTransaction spawnTestTransaction() { return new TokenAirdropTransaction() .setNodeAccountIds(Arrays.asList(AccountId.fromString("0.0.5005"), AccountId.fromString("0.0.5006"))) diff --git a/sdk/src/test/java/com/hedera/hashgraph/sdk/TokenAssociateTransactionTest.java b/sdk/src/test/java/com/hedera/hashgraph/sdk/TokenAssociateTransactionTest.java index ae14c4200..6fd0295db 100644 --- a/sdk/src/test/java/com/hedera/hashgraph/sdk/TokenAssociateTransactionTest.java +++ b/sdk/src/test/java/com/hedera/hashgraph/sdk/TokenAssociateTransactionTest.java @@ -61,6 +61,13 @@ void shouldSerialize() { ).toMatchSnapshot(); } + @Test + void shouldBytesNoSetters() throws Exception { + var tx = new TokenAssociateTransaction(); + var tx2 = Transaction.fromBytes(tx.toBytes()); + assertThat(tx2.toString()).isEqualTo(tx.toString()); + } + private TokenAssociateTransaction spawnTestTransaction() { return new TokenAssociateTransaction() .setNodeAccountIds(Arrays.asList(AccountId.fromString("0.0.5005"), AccountId.fromString("0.0.5006"))) diff --git a/sdk/src/test/java/com/hedera/hashgraph/sdk/TokenBurnTransactionTest.java b/sdk/src/test/java/com/hedera/hashgraph/sdk/TokenBurnTransactionTest.java index 300972dec..e62fce389 100644 --- a/sdk/src/test/java/com/hedera/hashgraph/sdk/TokenBurnTransactionTest.java +++ b/sdk/src/test/java/com/hedera/hashgraph/sdk/TokenBurnTransactionTest.java @@ -66,6 +66,13 @@ private TokenBurnTransaction spawnTestTransaction() { .sign(unusedPrivateKey); } + @Test + void shouldBytesNoSetters() throws Exception { + var tx = new TokenBurnTransaction(); + var tx2 = Transaction.fromBytes(tx.toBytes()); + assertThat(tx2.toString()).isEqualTo(tx.toString()); + } + @Test void shouldSerializeNft() { SnapshotMatcher.expect(spawnTestTransactionNft().toString()).toMatchSnapshot(); diff --git a/sdk/src/test/java/com/hedera/hashgraph/sdk/TokenCancelAirdropTransactionTest.java b/sdk/src/test/java/com/hedera/hashgraph/sdk/TokenCancelAirdropTransactionTest.java index 548e0b5e6..be4cbcddb 100644 --- a/sdk/src/test/java/com/hedera/hashgraph/sdk/TokenCancelAirdropTransactionTest.java +++ b/sdk/src/test/java/com/hedera/hashgraph/sdk/TokenCancelAirdropTransactionTest.java @@ -19,6 +19,8 @@ */ package com.hedera.hashgraph.sdk; +import static org.assertj.core.api.Assertions.assertThat; + import com.hedera.hashgraph.sdk.proto.SchedulableTransactionBody; import com.hedera.hashgraph.sdk.proto.TokenCancelAirdropTransactionBody; import com.hedera.hashgraph.sdk.proto.TokenServiceGrpc; @@ -73,7 +75,12 @@ void shouldSerialize() { .toString() ).toMatchSnapshot(); } - + @Test + void shouldBytesNoSetters() throws Exception { + var tx = new TokenCancelAirdropTransaction(); + var tx2 = Transaction.fromBytes(tx.toBytes()); + assertThat(tx2.toString()).isEqualTo(tx.toString()); + } @BeforeEach public void setUp() { diff --git a/sdk/src/test/java/com/hedera/hashgraph/sdk/TokenClaimAirdropTransactionTest.java b/sdk/src/test/java/com/hedera/hashgraph/sdk/TokenClaimAirdropTransactionTest.java index 7445670a4..2a912ae73 100644 --- a/sdk/src/test/java/com/hedera/hashgraph/sdk/TokenClaimAirdropTransactionTest.java +++ b/sdk/src/test/java/com/hedera/hashgraph/sdk/TokenClaimAirdropTransactionTest.java @@ -19,6 +19,8 @@ */ package com.hedera.hashgraph.sdk; +import static org.assertj.core.api.Assertions.assertThat; + import com.hedera.hashgraph.sdk.proto.SchedulableTransactionBody; import com.hedera.hashgraph.sdk.proto.TokenClaimAirdropTransactionBody; import com.hedera.hashgraph.sdk.proto.TokenServiceGrpc; @@ -74,6 +76,12 @@ void shouldSerialize() { ).toMatchSnapshot(); } + @Test + void shouldBytesNoSetters() throws Exception { + var tx = new TokenClaimAirdropTransaction(); + var tx2 = Transaction.fromBytes(tx.toBytes()); + assertThat(tx2.toString()).isEqualTo(tx.toString()); + } @BeforeEach public void setUp() { diff --git a/sdk/src/test/java/com/hedera/hashgraph/sdk/TokenCreateTransactionTest.java b/sdk/src/test/java/com/hedera/hashgraph/sdk/TokenCreateTransactionTest.java index 286c7ea46..e7c4640d5 100644 --- a/sdk/src/test/java/com/hedera/hashgraph/sdk/TokenCreateTransactionTest.java +++ b/sdk/src/test/java/com/hedera/hashgraph/sdk/TokenCreateTransactionTest.java @@ -97,6 +97,13 @@ void shouldSerializeFungible() { SnapshotMatcher.expect(spawnTestTransactionFungible().toString()).toMatchSnapshot(); } + @Test + void shouldBytesNoSetters() throws Exception { + var tx = new TokenCreateTransaction(); + var tx2 = Transaction.fromBytes(tx.toBytes()); + assertThat(tx2.toString()).isEqualTo(tx.toString()); + } + @Test void shouldSerializeNft() { SnapshotMatcher.expect(spawnTestTransactionNft().toString()).toMatchSnapshot(); diff --git a/sdk/src/test/java/com/hedera/hashgraph/sdk/TokenDeleteTransactionTest.java b/sdk/src/test/java/com/hedera/hashgraph/sdk/TokenDeleteTransactionTest.java index e58b2d053..c7f22095f 100644 --- a/sdk/src/test/java/com/hedera/hashgraph/sdk/TokenDeleteTransactionTest.java +++ b/sdk/src/test/java/com/hedera/hashgraph/sdk/TokenDeleteTransactionTest.java @@ -54,6 +54,13 @@ void shouldSerialize() { SnapshotMatcher.expect(spawnTestTransaction().toString()).toMatchSnapshot(); } + @Test + void shouldBytesNoSetters() throws Exception { + var tx = new TokenDeleteTransaction(); + var tx2 = Transaction.fromBytes(tx.toBytes()); + assertThat(tx2.toString()).isEqualTo(tx.toString()); + } + private TokenDeleteTransaction spawnTestTransaction() { return new TokenDeleteTransaction().setNodeAccountIds( Arrays.asList(AccountId.fromString("0.0.5005"), AccountId.fromString("0.0.5006"))) diff --git a/sdk/src/test/java/com/hedera/hashgraph/sdk/TokenDissociateTransactionTest.java b/sdk/src/test/java/com/hedera/hashgraph/sdk/TokenDissociateTransactionTest.java index 9635c3dfe..16733ec73 100644 --- a/sdk/src/test/java/com/hedera/hashgraph/sdk/TokenDissociateTransactionTest.java +++ b/sdk/src/test/java/com/hedera/hashgraph/sdk/TokenDissociateTransactionTest.java @@ -59,6 +59,13 @@ void shouldSerialize() { SnapshotMatcher.expect(spawnTestTransaction().toString()).toMatchSnapshot(); } + @Test + void shouldBytesNoSetters() throws Exception { + var tx = new TokenDissociateTransaction(); + var tx2 = Transaction.fromBytes(tx.toBytes()); + assertThat(tx2.toString()).isEqualTo(tx.toString()); + } + private TokenDissociateTransaction spawnTestTransaction() { return new TokenDissociateTransaction().setNodeAccountIds( Arrays.asList(AccountId.fromString("0.0.5005"), AccountId.fromString("0.0.5006"))) diff --git a/sdk/src/test/java/com/hedera/hashgraph/sdk/TokenFeeScheduleUpdateTransactionTest.java b/sdk/src/test/java/com/hedera/hashgraph/sdk/TokenFeeScheduleUpdateTransactionTest.java index b7e2bea70..1ec0049d5 100644 --- a/sdk/src/test/java/com/hedera/hashgraph/sdk/TokenFeeScheduleUpdateTransactionTest.java +++ b/sdk/src/test/java/com/hedera/hashgraph/sdk/TokenFeeScheduleUpdateTransactionTest.java @@ -70,6 +70,13 @@ private TokenFeeScheduleUpdateTransaction spawnTestTransaction() { .freeze(); } + @Test + void shouldBytesNoSetters() throws Exception { + var tx = new TokenFeeScheduleUpdateTransaction(); + var tx2 = Transaction.fromBytes(tx.toBytes()); + assertThat(tx2.toString()).isEqualTo(tx.toString()); + } + @Test void shouldSerialize() throws InvalidProtocolBufferException { var originalUpdate = spawnTestTransaction(); diff --git a/sdk/src/test/java/com/hedera/hashgraph/sdk/TokenFreezeTransactionTest.java b/sdk/src/test/java/com/hedera/hashgraph/sdk/TokenFreezeTransactionTest.java index 017d6cfb2..82a064723 100644 --- a/sdk/src/test/java/com/hedera/hashgraph/sdk/TokenFreezeTransactionTest.java +++ b/sdk/src/test/java/com/hedera/hashgraph/sdk/TokenFreezeTransactionTest.java @@ -65,6 +65,13 @@ private TokenFreezeTransaction spawnTestTransaction() { .sign(unusedPrivateKey); } + @Test + void shouldBytesNoSetters() throws Exception { + var tx = new TokenFreezeTransaction(); + var tx2 = Transaction.fromBytes(tx.toBytes()); + assertThat(tx2.toString()).isEqualTo(tx.toString()); + } + @Test void shouldBytes() throws Exception { var tx = spawnTestTransaction(); diff --git a/sdk/src/test/java/com/hedera/hashgraph/sdk/TokenGrantKycTransactionTest.java b/sdk/src/test/java/com/hedera/hashgraph/sdk/TokenGrantKycTransactionTest.java index d912ca40a..3131d761c 100644 --- a/sdk/src/test/java/com/hedera/hashgraph/sdk/TokenGrantKycTransactionTest.java +++ b/sdk/src/test/java/com/hedera/hashgraph/sdk/TokenGrantKycTransactionTest.java @@ -71,6 +71,13 @@ void shouldBytes() throws Exception { assertThat(tx2.toString()).isEqualTo(tx.toString()); } + @Test + void shouldBytesNoSetters() throws Exception { + var tx = new TokenGrantKycTransaction(); + var tx2 = Transaction.fromBytes(tx.toBytes()); + assertThat(tx2.toString()).isEqualTo(tx.toString()); + } + @Test void fromScheduledTransaction() { var transactionBody = SchedulableTransactionBody.newBuilder() diff --git a/sdk/src/test/java/com/hedera/hashgraph/sdk/TokenMintTransactionTest.java b/sdk/src/test/java/com/hedera/hashgraph/sdk/TokenMintTransactionTest.java index fe20d79cd..4dd1ab71c 100644 --- a/sdk/src/test/java/com/hedera/hashgraph/sdk/TokenMintTransactionTest.java +++ b/sdk/src/test/java/com/hedera/hashgraph/sdk/TokenMintTransactionTest.java @@ -50,6 +50,13 @@ void shouldSerializeMetadata() { ).toMatchSnapshot(); } + @Test + void shouldBytesNoSetters() throws Exception { + var tx = new TokenMintTransaction(); + var tx2 = Transaction.fromBytes(tx.toBytes()); + assertThat(tx2.toString()).isEqualTo(tx.toString()); + } + private TokenMintTransaction spawnTestTransaction() { return new TokenMintTransaction() .setNodeAccountIds(Arrays.asList(AccountId.fromString("0.0.5005"), AccountId.fromString("0.0.5006"))) diff --git a/sdk/src/test/java/com/hedera/hashgraph/sdk/TokenPauseTransactionTest.java b/sdk/src/test/java/com/hedera/hashgraph/sdk/TokenPauseTransactionTest.java index 8afd61f51..fa86516a8 100644 --- a/sdk/src/test/java/com/hedera/hashgraph/sdk/TokenPauseTransactionTest.java +++ b/sdk/src/test/java/com/hedera/hashgraph/sdk/TokenPauseTransactionTest.java @@ -64,7 +64,14 @@ void shouldSerialize() { @Test void shouldBytesNft() throws Exception { var tx = spawnTestTransaction(); - var tx2 = TokenCreateTransaction.fromBytes(tx.toBytes()); + var tx2 = Transaction.fromBytes(tx.toBytes()); + assertThat(tx2.toString()).isEqualTo(tx.toString()); + } + + @Test + void shouldBytesNoSetters() throws Exception { + var tx = new TokenPauseTransaction(); + var tx2 = Transaction.fromBytes(tx.toBytes()); assertThat(tx2.toString()).isEqualTo(tx.toString()); } diff --git a/sdk/src/test/java/com/hedera/hashgraph/sdk/TokenRejectTransactionTest.java b/sdk/src/test/java/com/hedera/hashgraph/sdk/TokenRejectTransactionTest.java index 6ca229b6f..5698fd885 100644 --- a/sdk/src/test/java/com/hedera/hashgraph/sdk/TokenRejectTransactionTest.java +++ b/sdk/src/test/java/com/hedera/hashgraph/sdk/TokenRejectTransactionTest.java @@ -75,6 +75,13 @@ private TokenRejectTransaction spawnTestTransaction() { .setMaxTransactionFee(new Hbar(1)).freeze().sign(TEST_PRIVATE_KEY); } + @Test + void shouldBytesNoSetters() throws Exception { + var tx = new TokenRejectTransaction(); + var tx2 = Transaction.fromBytes(tx.toBytes()); + assertThat(tx2.toString()).isEqualTo(tx.toString()); + } + @Test void shouldBytes() throws Exception { var tx = spawnTestTransaction(); diff --git a/sdk/src/test/java/com/hedera/hashgraph/sdk/TokenRevokeKycTransactionTest.java b/sdk/src/test/java/com/hedera/hashgraph/sdk/TokenRevokeKycTransactionTest.java index e8a270028..04264afc7 100644 --- a/sdk/src/test/java/com/hedera/hashgraph/sdk/TokenRevokeKycTransactionTest.java +++ b/sdk/src/test/java/com/hedera/hashgraph/sdk/TokenRevokeKycTransactionTest.java @@ -64,6 +64,13 @@ private TokenRevokeKycTransaction spawnTestTransaction() { .sign(unusedPrivateKey); } + @Test + void shouldBytesNoSetters() throws Exception { + var tx = new TokenRevokeKycTransaction(); + var tx2 = Transaction.fromBytes(tx.toBytes()); + assertThat(tx2.toString()).isEqualTo(tx.toString()); + } + @Test void shouldBytes() throws Exception { var tx = spawnTestTransaction(); diff --git a/sdk/src/test/java/com/hedera/hashgraph/sdk/TokenUnfreezeTransactionTest.java b/sdk/src/test/java/com/hedera/hashgraph/sdk/TokenUnfreezeTransactionTest.java index de42e6e29..e06365273 100644 --- a/sdk/src/test/java/com/hedera/hashgraph/sdk/TokenUnfreezeTransactionTest.java +++ b/sdk/src/test/java/com/hedera/hashgraph/sdk/TokenUnfreezeTransactionTest.java @@ -54,6 +54,13 @@ void shouldSerialize() { ).toMatchSnapshot(); } + @Test + void shouldBytesNoSetters() throws Exception { + var tx = new TokenUnfreezeTransaction(); + var tx2 = Transaction.fromBytes(tx.toBytes()); + assertThat(tx2.toString()).isEqualTo(tx.toString()); + } + private TokenUnfreezeTransaction spawnTestTransaction() { return new TokenUnfreezeTransaction() .setNodeAccountIds(Arrays.asList(AccountId.fromString("0.0.5005"), AccountId.fromString("0.0.5006"))) diff --git a/sdk/src/test/java/com/hedera/hashgraph/sdk/TokenUnpauseTransactionTest.java b/sdk/src/test/java/com/hedera/hashgraph/sdk/TokenUnpauseTransactionTest.java index a92dbaefe..2ae2822cb 100644 --- a/sdk/src/test/java/com/hedera/hashgraph/sdk/TokenUnpauseTransactionTest.java +++ b/sdk/src/test/java/com/hedera/hashgraph/sdk/TokenUnpauseTransactionTest.java @@ -57,6 +57,13 @@ TokenUnpauseTransaction spawnTestTransaction() { .setTokenId(testTokenId).setMaxTransactionFee(new Hbar(1)).freeze().sign(unusedPrivateKey); } + @Test + void shouldBytesNoSetters() throws Exception { + var tx = new TokenUnpauseTransaction(); + var tx2 = Transaction.fromBytes(tx.toBytes()); + assertThat(tx2.toString()).isEqualTo(tx.toString()); + } + @Test void shouldSerialize() { SnapshotMatcher.expect(spawnTestTransaction().toString()).toMatchSnapshot(); diff --git a/sdk/src/test/java/com/hedera/hashgraph/sdk/TokenUpdateNftsTransactionTest.java b/sdk/src/test/java/com/hedera/hashgraph/sdk/TokenUpdateNftsTransactionTest.java index 16d45e1d0..9c7950352 100644 --- a/sdk/src/test/java/com/hedera/hashgraph/sdk/TokenUpdateNftsTransactionTest.java +++ b/sdk/src/test/java/com/hedera/hashgraph/sdk/TokenUpdateNftsTransactionTest.java @@ -66,6 +66,13 @@ private TokenUpdateNftsTransaction spawnTestTransaction() { .setMaxTransactionFee(new Hbar(1)).freeze().sign(testMetadataKey); } + @Test + void shouldBytesNoSetters() throws Exception { + var tx = new TokenUpdateNftsTransaction(); + var tx2 = Transaction.fromBytes(tx.toBytes()); + assertThat(tx2.toString()).isEqualTo(tx.toString()); + } + @Test void shouldBytes() throws Exception { var tx = spawnTestTransaction(); diff --git a/sdk/src/test/java/com/hedera/hashgraph/sdk/TokenUpdateTransactionTest.java b/sdk/src/test/java/com/hedera/hashgraph/sdk/TokenUpdateTransactionTest.java index bade583e9..a728b1048 100644 --- a/sdk/src/test/java/com/hedera/hashgraph/sdk/TokenUpdateTransactionTest.java +++ b/sdk/src/test/java/com/hedera/hashgraph/sdk/TokenUpdateTransactionTest.java @@ -91,6 +91,13 @@ void shouldSerialize() { SnapshotMatcher.expect(spawnTestTransaction().toString()).toMatchSnapshot(); } + @Test + void shouldBytesNoSetters() throws Exception { + var tx = new TokenUpdateTransaction(); + var tx2 = Transaction.fromBytes(tx.toBytes()); + assertThat(tx2.toString()).isEqualTo(tx.toString()); + } + private TokenUpdateTransaction spawnTestTransaction() { return new TokenUpdateTransaction().setNodeAccountIds( Arrays.asList(AccountId.fromString("0.0.5005"), AccountId.fromString("0.0.5006"))) diff --git a/sdk/src/test/java/com/hedera/hashgraph/sdk/TokenWipeTransactionTest.java b/sdk/src/test/java/com/hedera/hashgraph/sdk/TokenWipeTransactionTest.java index 5fb777400..e8d9a043b 100644 --- a/sdk/src/test/java/com/hedera/hashgraph/sdk/TokenWipeTransactionTest.java +++ b/sdk/src/test/java/com/hedera/hashgraph/sdk/TokenWipeTransactionTest.java @@ -62,6 +62,13 @@ void shouldSerializeFungible() { ).toMatchSnapshot(); } + @Test + void shouldBytesNoSetters() throws Exception { + var tx = new TokenWipeTransaction(); + var tx2 = Transaction.fromBytes(tx.toBytes()); + assertThat(tx2.toString()).isEqualTo(tx.toString()); + } + private TokenWipeTransaction spawnTestTransaction() { return new TokenWipeTransaction() .setNodeAccountIds(Arrays.asList(AccountId.fromString("0.0.5005"), AccountId.fromString("0.0.5006"))) diff --git a/sdk/src/test/java/com/hedera/hashgraph/sdk/TopicCreateTransactionTest.java b/sdk/src/test/java/com/hedera/hashgraph/sdk/TopicCreateTransactionTest.java index 2528b67d2..b83266368 100644 --- a/sdk/src/test/java/com/hedera/hashgraph/sdk/TopicCreateTransactionTest.java +++ b/sdk/src/test/java/com/hedera/hashgraph/sdk/TopicCreateTransactionTest.java @@ -55,6 +55,13 @@ void shouldSerialize() { ).toMatchSnapshot(); } + @Test + void shouldBytesNoSetters() throws Exception { + var tx = new TopicCreateTransaction(); + var tx2 = Transaction.fromBytes(tx.toBytes()); + assertThat(tx2.toString()).isEqualTo(tx.toString()); + } + private TopicCreateTransaction spawnTestTransaction() { return new TopicCreateTransaction() .setNodeAccountIds(Arrays.asList(AccountId.fromString("0.0.5005"), AccountId.fromString("0.0.5006"))) diff --git a/sdk/src/test/java/com/hedera/hashgraph/sdk/TopicDeleteTransactionTest.java b/sdk/src/test/java/com/hedera/hashgraph/sdk/TopicDeleteTransactionTest.java index 964e8a33d..941f552c7 100644 --- a/sdk/src/test/java/com/hedera/hashgraph/sdk/TopicDeleteTransactionTest.java +++ b/sdk/src/test/java/com/hedera/hashgraph/sdk/TopicDeleteTransactionTest.java @@ -64,6 +64,12 @@ private TopicDeleteTransaction spawnTestTransaction() { .sign(unusedPrivateKey); } + @Test + void shouldBytesNoSetters() throws Exception { + var tx = new TopicDeleteTransaction(); + var tx2 = Transaction.fromBytes(tx.toBytes()); + assertThat(tx2.toString()).isEqualTo(tx.toString()); + } @Test void shouldBytes() throws Exception { var tx = spawnTestTransaction(); diff --git a/sdk/src/test/java/com/hedera/hashgraph/sdk/TopicMessageSubmitTransactionTest.java b/sdk/src/test/java/com/hedera/hashgraph/sdk/TopicMessageSubmitTransactionTest.java index 0ff928f52..d4241074d 100644 --- a/sdk/src/test/java/com/hedera/hashgraph/sdk/TopicMessageSubmitTransactionTest.java +++ b/sdk/src/test/java/com/hedera/hashgraph/sdk/TopicMessageSubmitTransactionTest.java @@ -46,6 +46,13 @@ private TopicMessageSubmitTransaction spawnTestTransactionBytes() { .setTopicId(testTopicId).setMessage(testMessageBytes).freeze().sign(unusedPrivateKey); } + @Test + void shouldBytesNoSetters() throws Exception { + var tx = new TopicMessageSubmitTransaction(); + var tx2 = Transaction.fromBytes(tx.toBytes()); + assertThat(tx2.toString()).isEqualTo(tx.toString()); + } + @Test void fromScheduledTransaction() { var transactionBody = SchedulableTransactionBody.newBuilder() diff --git a/sdk/src/test/java/com/hedera/hashgraph/sdk/TopicUpdateTransactionTest.java b/sdk/src/test/java/com/hedera/hashgraph/sdk/TopicUpdateTransactionTest.java index 6214b4755..9cda568a9 100644 --- a/sdk/src/test/java/com/hedera/hashgraph/sdk/TopicUpdateTransactionTest.java +++ b/sdk/src/test/java/com/hedera/hashgraph/sdk/TopicUpdateTransactionTest.java @@ -76,7 +76,12 @@ void clearShouldSerialize() { void setShouldSerialize() { SnapshotMatcher.expect(spawnTestTransaction().toString()).toMatchSnapshot(); } - + @Test + void shouldBytesNoSetters() throws Exception { + var tx = new TopicUpdateTransaction(); + var tx2 = Transaction.fromBytes(tx.toBytes()); + assertThat(tx2.toString()).isEqualTo(tx.toString()); + } private TopicUpdateTransaction spawnTestTransaction() { return new TopicUpdateTransaction().setNodeAccountIds( Arrays.asList(AccountId.fromString("0.0.5005"), AccountId.fromString("0.0.5006")))