20TEST(TransactionsMPTokenIssuanceSetTests, BuilderSettersRoundTrip)
23 auto const [publicKey, secretKey] =
41 mPTokenIssuanceIDValue,
47 builder.setHolder(holderValue);
48 builder.setDomainID(domainIDValue);
49 builder.setMPTokenMetadata(mPTokenMetadataValue);
50 builder.setTransferFee(transferFeeValue);
51 builder.setMutableFlags(mutableFlagsValue);
53 auto tx = builder.build(publicKey, secretKey);
56 EXPECT_TRUE(tx.validate(reason)) << reason;
59 EXPECT_FALSE(tx.getSigningPubKey().empty());
60 EXPECT_TRUE(tx.hasTxnSignature());
63 EXPECT_EQ(tx.getAccount(), accountValue);
64 EXPECT_EQ(tx.getSequence(), sequenceValue);
65 EXPECT_EQ(tx.getFee(), feeValue);
69 auto const& expected = mPTokenIssuanceIDValue;
70 auto const actual = tx.getMPTokenIssuanceID();
76 auto const& expected = holderValue;
77 auto const actualOpt = tx.getHolder();
78 ASSERT_TRUE(actualOpt.has_value()) <<
"Optional field sfHolder should be present";
80 EXPECT_TRUE(tx.hasHolder());
84 auto const& expected = domainIDValue;
85 auto const actualOpt = tx.getDomainID();
86 ASSERT_TRUE(actualOpt.has_value()) <<
"Optional field sfDomainID should be present";
88 EXPECT_TRUE(tx.hasDomainID());
92 auto const& expected = mPTokenMetadataValue;
93 auto const actualOpt = tx.getMPTokenMetadata();
94 ASSERT_TRUE(actualOpt.has_value()) <<
"Optional field sfMPTokenMetadata should be present";
96 EXPECT_TRUE(tx.hasMPTokenMetadata());
100 auto const& expected = transferFeeValue;
101 auto const actualOpt = tx.getTransferFee();
102 ASSERT_TRUE(actualOpt.has_value()) <<
"Optional field sfTransferFee should be present";
104 EXPECT_TRUE(tx.hasTransferFee());
108 auto const& expected = mutableFlagsValue;
109 auto const actualOpt = tx.getMutableFlags();
110 ASSERT_TRUE(actualOpt.has_value()) <<
"Optional field sfMutableFlags should be present";
112 EXPECT_TRUE(tx.hasMutableFlags());
119TEST(TransactionsMPTokenIssuanceSetTests, BuilderFromStTxRoundTrip)
122 auto const [publicKey, secretKey] =
141 mPTokenIssuanceIDValue,
146 initialBuilder.setHolder(holderValue);
147 initialBuilder.setDomainID(domainIDValue);
148 initialBuilder.setMPTokenMetadata(mPTokenMetadataValue);
149 initialBuilder.setTransferFee(transferFeeValue);
150 initialBuilder.setMutableFlags(mutableFlagsValue);
152 auto initialTx = initialBuilder.build(publicKey, secretKey);
157 auto rebuiltTx = builderFromTx.
build(publicKey, secretKey);
160 EXPECT_TRUE(rebuiltTx.validate(reason)) << reason;
163 EXPECT_EQ(rebuiltTx.getAccount(), accountValue);
164 EXPECT_EQ(rebuiltTx.getSequence(), sequenceValue);
165 EXPECT_EQ(rebuiltTx.getFee(), feeValue);
169 auto const& expected = mPTokenIssuanceIDValue;
170 auto const actual = rebuiltTx.getMPTokenIssuanceID();
176 auto const& expected = holderValue;
177 auto const actualOpt = rebuiltTx.getHolder();
178 ASSERT_TRUE(actualOpt.has_value()) <<
"Optional field sfHolder should be present";
183 auto const& expected = domainIDValue;
184 auto const actualOpt = rebuiltTx.getDomainID();
185 ASSERT_TRUE(actualOpt.has_value()) <<
"Optional field sfDomainID should be present";
190 auto const& expected = mPTokenMetadataValue;
191 auto const actualOpt = rebuiltTx.getMPTokenMetadata();
192 ASSERT_TRUE(actualOpt.has_value()) <<
"Optional field sfMPTokenMetadata should be present";
197 auto const& expected = transferFeeValue;
198 auto const actualOpt = rebuiltTx.getTransferFee();
199 ASSERT_TRUE(actualOpt.has_value()) <<
"Optional field sfTransferFee should be present";
204 auto const& expected = mutableFlagsValue;
205 auto const actualOpt = rebuiltTx.getMutableFlags();
206 ASSERT_TRUE(actualOpt.has_value()) <<
"Optional field sfMutableFlags should be present";
241TEST(TransactionsMPTokenIssuanceSetTests, OptionalFieldsReturnNullopt)
244 auto const [publicKey, secretKey] =
257 mPTokenIssuanceIDValue,
264 auto tx = builder.build(publicKey, secretKey);
267 EXPECT_FALSE(tx.hasHolder());
268 EXPECT_FALSE(tx.getHolder().has_value());
269 EXPECT_FALSE(tx.hasDomainID());
270 EXPECT_FALSE(tx.getDomainID().has_value());
271 EXPECT_FALSE(tx.hasMPTokenMetadata());
272 EXPECT_FALSE(tx.getMPTokenMetadata().has_value());
273 EXPECT_FALSE(tx.hasTransferFee());
274 EXPECT_FALSE(tx.getTransferFee().has_value());
275 EXPECT_FALSE(tx.hasMutableFlags());
276 EXPECT_FALSE(tx.getMutableFlags().has_value());