20TEST(TransactionsLoanBrokerCoverClawbackTests, BuilderSettersRoundTrip)
23 auto const [publicKey, secretKey] =
42 builder.setLoanBrokerID(loanBrokerIDValue);
43 builder.setAmount(amountValue);
45 auto tx = builder.build(publicKey, secretKey);
48 EXPECT_TRUE(tx.validate(reason)) << reason;
51 EXPECT_FALSE(tx.getSigningPubKey().empty());
52 EXPECT_TRUE(tx.hasTxnSignature());
55 EXPECT_EQ(tx.getAccount(), accountValue);
56 EXPECT_EQ(tx.getSequence(), sequenceValue);
57 EXPECT_EQ(tx.getFee(), feeValue);
62 auto const& expected = loanBrokerIDValue;
63 auto const actualOpt = tx.getLoanBrokerID();
64 ASSERT_TRUE(actualOpt.has_value()) <<
"Optional field sfLoanBrokerID should be present";
66 EXPECT_TRUE(tx.hasLoanBrokerID());
70 auto const& expected = amountValue;
71 auto const actualOpt = tx.getAmount();
72 ASSERT_TRUE(actualOpt.has_value()) <<
"Optional field sfAmount should be present";
74 EXPECT_TRUE(tx.hasAmount());
81TEST(TransactionsLoanBrokerCoverClawbackTests, BuilderFromStTxRoundTrip)
84 auto const [publicKey, secretKey] =
103 initialBuilder.setLoanBrokerID(loanBrokerIDValue);
104 initialBuilder.setAmount(amountValue);
106 auto initialTx = initialBuilder.build(publicKey, secretKey);
111 auto rebuiltTx = builderFromTx.
build(publicKey, secretKey);
114 EXPECT_TRUE(rebuiltTx.validate(reason)) << reason;
117 EXPECT_EQ(rebuiltTx.getAccount(), accountValue);
118 EXPECT_EQ(rebuiltTx.getSequence(), sequenceValue);
119 EXPECT_EQ(rebuiltTx.getFee(), feeValue);
124 auto const& expected = loanBrokerIDValue;
125 auto const actualOpt = rebuiltTx.getLoanBrokerID();
126 ASSERT_TRUE(actualOpt.has_value()) <<
"Optional field sfLoanBrokerID should be present";
131 auto const& expected = amountValue;
132 auto const actualOpt = rebuiltTx.getAmount();
133 ASSERT_TRUE(actualOpt.has_value()) <<
"Optional field sfAmount should be present";
168TEST(TransactionsLoanBrokerCoverClawbackTests, OptionalFieldsReturnNullopt)
171 auto const [publicKey, secretKey] =
189 auto tx = builder.build(publicKey, secretKey);
192 EXPECT_FALSE(tx.hasLoanBrokerID());
193 EXPECT_FALSE(tx.getLoanBrokerID().has_value());
194 EXPECT_FALSE(tx.hasAmount());
195 EXPECT_FALSE(tx.getAmount().has_value());