@@ -69,6 +69,7 @@ constexpr auto kTXN_ID = "E6DBAFC99223B42257915A63DFC6B0C032D4070F9A574B255AD974
6969constexpr auto kAMM_ACCOUNT = " rnW8FAPgpQgA6VoESnVrUVJHBdq9QAtRZs" ;
7070constexpr auto kISSUER = " rK9DrarGKnVEo2nYp5MfVRXRYf5yRX3mwD" ;
7171constexpr auto kLPTOKEN_CURRENCY = " 037C35306B24AAB7FF90848206E003279AA47090" ;
72+ constexpr auto kAMM_ID = 54321 ;
7273
7374} // namespace
7475
@@ -567,22 +568,18 @@ TEST_F(RPCHelpersTest, AccountHoldsFixLPTAmendmentDisabled)
567568 auto const lptRippleStateKk = ripple::keylet::line (ammAccount, account, ripple::to_currency (kLPTOKEN_CURRENCY )).key ;
568569
569570 // trustline fetched twice. once in accountHolds and once in isFrozen
570- EXPECT_CALL (*backend_, doFetchLedgerObject (lptRippleStateKk, testing::_, testing::_)). Times ( 2 );
571- ON_CALL (*backend_, doFetchLedgerObject (lptRippleStateKk, testing::_, testing::_) )
572- .WillByDefault ( testing:: Return (lptRippleState.getSerializer ().peekData ()));
571+ EXPECT_CALL (*backend_, doFetchLedgerObject (lptRippleStateKk, testing::_, testing::_))
572+ . Times ( 2 )
573+ .WillRepeatedly ( Return (lptRippleState.getSerializer ().peekData ()));
573574
574- auto const ammID = ripple::uint256{54321 };
575+ auto const ammID = ripple::uint256{kAMM_ID };
575576 auto const ammAccountKk = ripple::keylet::account (ammAccount).key ;
576577 auto const ammAccountRoot = createAccountRootObject (kAMM_ACCOUNT , 0 , 2 , 200 , 2 , kINDEX1 , 2 , 0 , ammID);
577578
578- EXPECT_CALL (*backend_, doFetchLedgerObject (ammAccountKk, testing::_, testing::_)).Times (1 );
579- ON_CALL (*backend_, doFetchLedgerObject (ammAccountKk, testing::_, testing::_))
580- .WillByDefault (Return (ammAccountRoot.getSerializer ().peekData ()));
579+ EXPECT_CALL (*backend_, doFetchLedgerObject (ammAccountKk, testing::_, testing::_)).WillOnce (Return (ammAccountRoot.getSerializer ().peekData ()));
581580
582581 EXPECT_CALL (*mockAmendmentCenterPtr_, isEnabled (testing::_, Amendments::fixFrozenLPTokenTransfer, testing::_))
583- .Times (1 );
584- ON_CALL (*mockAmendmentCenterPtr_, isEnabled (testing::_, Amendments::fixFrozenLPTokenTransfer, testing::_))
585- .WillByDefault (testing::Return (false ));
582+ .WillOnce (Return (false ));
586583
587584 boost::asio::spawn (ctx_, [&, this ](boost::asio::yield_context yield) {
588585 auto ret = accountHolds (
@@ -610,21 +607,19 @@ TEST_F(RPCHelpersTest, AccountHoldsLPTokenNotAMMAccount)
610607 auto const usdRippleStateKk = ripple::keylet::line (account2, account, ripple::to_currency (" USD" )).key ;
611608
612609 // trustline fetched twice. once in accountHolds and once in isFrozen
613- EXPECT_CALL (*backend_, doFetchLedgerObject (usdRippleStateKk, testing::_, testing::_)). Times ( 2 );
614- ON_CALL (*backend_, doFetchLedgerObject (usdRippleStateKk, testing::_, testing::_) )
615- .WillByDefault ( testing:: Return (usdRippleState.getSerializer ().peekData ()));
610+ EXPECT_CALL (*backend_, doFetchLedgerObject (usdRippleStateKk, testing::_, testing::_))
611+ . Times ( 2 )
612+ .WillRepeatedly ( Return (usdRippleState.getSerializer ().peekData ()));
616613
617614 EXPECT_CALL (*mockAmendmentCenterPtr_, isEnabled (testing::_, Amendments::fixFrozenLPTokenTransfer, testing::_))
618- .Times (1 );
619- ON_CALL (*mockAmendmentCenterPtr_, isEnabled (testing::_, Amendments::fixFrozenLPTokenTransfer, testing::_))
620- .WillByDefault (testing::Return (true ));
615+ .WillOnce (Return (true ));
621616
622617 auto const account2Kk = ripple::keylet::account (account2).key ;
623618 auto const account2Root = createAccountRootObject (kACCOUNT2 , 0 , 2 , 200 , 2 , kINDEX1 , 2 , 0 );
624619
625- EXPECT_CALL (*backend_, doFetchLedgerObject (account2Kk, testing::_, testing::_)). Times ( 2 );
626- ON_CALL (*backend_, doFetchLedgerObject (account2Kk, testing::_, testing::_) )
627- .WillByDefault (Return (account2Root.getSerializer ().peekData ()));
620+ EXPECT_CALL (*backend_, doFetchLedgerObject (account2Kk, testing::_, testing::_))
621+ . Times ( 2 )
622+ .WillRepeatedly (Return (account2Root.getSerializer ().peekData ()));
628623
629624 boost::asio::spawn (ctx_, [&, this ](boost::asio::yield_context yield) {
630625 auto ret = accountHolds (
@@ -647,34 +642,29 @@ TEST_F(RPCHelpersTest, AccountHoldsLPTokenAsset1Frozen)
647642 auto const lptRippleStateKk = ripple::keylet::line (ammAccount, account, ripple::to_currency (kLPTOKEN_CURRENCY )).key ;
648643
649644 // trustline fetched twice. once in accountHolds and once in isFrozen
650- EXPECT_CALL (*backend_, doFetchLedgerObject (lptRippleStateKk, testing::_, testing::_)). Times ( 2 );
651- ON_CALL (*backend_, doFetchLedgerObject (lptRippleStateKk, testing::_, testing::_) )
652- .WillByDefault ( testing:: Return (lptRippleState.getSerializer ().peekData ()));
645+ EXPECT_CALL (*backend_, doFetchLedgerObject (lptRippleStateKk, testing::_, testing::_))
646+ . Times ( 2 )
647+ .WillRepeatedly ( Return (lptRippleState.getSerializer ().peekData ()));
653648
654649 EXPECT_CALL (*mockAmendmentCenterPtr_, isEnabled (testing::_, Amendments::fixFrozenLPTokenTransfer, testing::_))
655- .Times (1 );
656- ON_CALL (*mockAmendmentCenterPtr_, isEnabled (testing::_, Amendments::fixFrozenLPTokenTransfer, testing::_))
657- .WillByDefault (testing::Return (true ));
650+ .WillOnce (Return (true ));
658651
659- auto const ammID = ripple::uint256{54321 };
652+ auto const ammID = ripple::uint256{kAMM_ID };
660653 auto const ammAccountKk = ripple::keylet::account (ammAccount).key ;
661654 auto const ammAccountRoot = createAccountRootObject (kAMM_ACCOUNT , 0 , 2 , 200 , 2 , kINDEX1 , 2 , 0 , ammID);
662655
663656 // accountroot fetched twice, once in isFrozen, once in accountHolds
664- EXPECT_CALL (*backend_, doFetchLedgerObject (ammAccountKk, testing::_, testing::_)). Times ( 2 );
665- ON_CALL (*backend_, doFetchLedgerObject (ammAccountKk, testing::_, testing::_) )
666- .WillByDefault (Return (ammAccountRoot.getSerializer ().peekData ()));
657+ EXPECT_CALL (*backend_, doFetchLedgerObject (ammAccountKk, testing::_, testing::_))
658+ . Times ( 2 )
659+ .WillRepeatedly (Return (ammAccountRoot.getSerializer ().peekData ()));
667660
668661 auto const amm = createAmmObject (kAMM_ACCOUNT , " USD" , kISSUER , " XRP" , ripple::toBase58 (ripple::xrpAccount ()));
669- EXPECT_CALL (*backend_, doFetchLedgerObject (ripple::keylet::amm (ammID).key , testing::_, testing::_)).Times (1 );
670- ON_CALL (*backend_, doFetchLedgerObject (ripple::keylet::amm (ammID).key , testing::_, testing::_))
671- .WillByDefault (testing::Return (amm.getSerializer ().peekData ()));
662+ EXPECT_CALL (*backend_, doFetchLedgerObject (ripple::keylet::amm (ammID).key , testing::_, testing::_)).Times (1 ).WillOnce (Return (amm.getSerializer ().peekData ()));
672663
673664 auto const issuerKk = ripple::keylet::account (issuer).key ;
674665 auto const issuerAccountRoot = createAccountRootObject (kISSUER , ripple::lsfGlobalFreeze, 2 , 200 , 2 , kINDEX1 , 2 , 0 );
675- EXPECT_CALL (*backend_, doFetchLedgerObject (issuerKk, testing::_, testing::_)).Times (1 );
676- ON_CALL (*backend_, doFetchLedgerObject (issuerKk, testing::_, testing::_))
677- .WillByDefault (Return (issuerAccountRoot.getSerializer ().peekData ()));
666+ EXPECT_CALL (*backend_, doFetchLedgerObject (issuerKk, testing::_, testing::_))
667+ .WillOnce (Return (issuerAccountRoot.getSerializer ().peekData ()));
678668
679669 boost::asio::spawn (ctx_, [&, this ](boost::asio::yield_context yield) {
680670 auto ret = accountHolds (
@@ -709,29 +699,25 @@ TEST_F(RPCHelpersTest, AccountHoldsLPTokenAsset2Frozen)
709699 .WillByDefault (testing::Return (lptRippleState.getSerializer ().peekData ()));
710700
711701 EXPECT_CALL (*mockAmendmentCenterPtr_, isEnabled (testing::_, Amendments::fixFrozenLPTokenTransfer, testing::_))
712- .Times (1 );
713- ON_CALL (*mockAmendmentCenterPtr_, isEnabled (testing::_, Amendments::fixFrozenLPTokenTransfer, testing::_))
714- .WillByDefault (testing::Return (true ));
702+ .WillOnce (testing::Return (true ));
715703
716- auto const ammID = ripple::uint256{54321 };
704+ auto const ammID = ripple::uint256{kAMM_ID };
717705 auto const ammAccountKk = ripple::keylet::account (ammAccount).key ;
718706 auto const ammAccountRoot = createAccountRootObject (kAMM_ACCOUNT , 0 , 2 , 200 , 2 , kINDEX1 , 2 , 0 , ammID);
719707
720708 // accountroot fetched twice, once in isFrozen, once in accountHolds
721- EXPECT_CALL (*backend_, doFetchLedgerObject (ammAccountKk, testing::_, testing::_)). Times ( 2 );
722- ON_CALL (*backend_, doFetchLedgerObject (ammAccountKk, testing::_, testing::_) )
723- .WillByDefault (Return (ammAccountRoot.getSerializer ().peekData ()));
709+ EXPECT_CALL (*backend_, doFetchLedgerObject (ammAccountKk, testing::_, testing::_))
710+ . Times ( 2 )
711+ .WillRepeatedly (Return (ammAccountRoot.getSerializer ().peekData ()));
724712
725713 auto const amm = createAmmObject (kAMM_ACCOUNT , " XRP" , ripple::toBase58 (ripple::xrpAccount ()), " USD" , kISSUER );
726- EXPECT_CALL (*backend_, doFetchLedgerObject (ripple::keylet::amm (ammID).key , testing::_, testing::_)).Times (1 );
727- ON_CALL (*backend_, doFetchLedgerObject (ripple::keylet::amm (ammID).key , testing::_, testing::_))
728- .WillByDefault (testing::Return (amm.getSerializer ().peekData ()));
714+ EXPECT_CALL (*backend_, doFetchLedgerObject (ripple::keylet::amm (ammID).key , testing::_, testing::_))
715+ .WillOnce (Return (amm.getSerializer ().peekData ()));
729716
730717 auto const issuerKk = ripple::keylet::account (issuer).key ;
731718 auto const issuerAccountRoot = createAccountRootObject (kISSUER , ripple::lsfGlobalFreeze, 2 , 200 , 2 , kINDEX1 , 2 , 0 );
732- EXPECT_CALL (*backend_, doFetchLedgerObject (issuerKk, testing::_, testing::_)).Times (1 );
733- ON_CALL (*backend_, doFetchLedgerObject (issuerKk, testing::_, testing::_))
734- .WillByDefault (Return (issuerAccountRoot.getSerializer ().peekData ()));
719+ EXPECT_CALL (*backend_, doFetchLedgerObject (issuerKk, testing::_, testing::_))
720+ .WillOnce (Return (issuerAccountRoot.getSerializer ().peekData ()));
735721
736722 boost::asio::spawn (ctx_, [&, this ](boost::asio::yield_context yield) {
737723 auto ret = accountHolds (
@@ -761,42 +747,37 @@ TEST_F(RPCHelpersTest, AccountHoldsLPTokenUnfrozen)
761747 auto const lptRippleStateKk = ripple::keylet::line (ammAccount, account, ripple::to_currency (kLPTOKEN_CURRENCY )).key ;
762748
763749 // trustline fetched twice. once in accountHolds and once in isFrozen
764- EXPECT_CALL (*backend_, doFetchLedgerObject (lptRippleStateKk, testing::_, testing::_)). Times ( 2 );
765- ON_CALL (*backend_, doFetchLedgerObject (lptRippleStateKk, testing::_, testing::_) )
766- .WillByDefault ( testing:: Return (lptRippleState.getSerializer ().peekData ()));
750+ EXPECT_CALL (*backend_, doFetchLedgerObject (lptRippleStateKk, testing::_, testing::_))
751+ . Times ( 2 )
752+ .WillRepeatedly ( Return (lptRippleState.getSerializer ().peekData ()));
767753
768754 EXPECT_CALL (*mockAmendmentCenterPtr_, isEnabled (testing::_, Amendments::fixFrozenLPTokenTransfer, testing::_))
769- .Times (1 );
770- ON_CALL (*mockAmendmentCenterPtr_, isEnabled (testing::_, Amendments::fixFrozenLPTokenTransfer, testing::_))
771- .WillByDefault (testing::Return (true ));
755+ .WillOnce (Return (true ));
772756
773- auto const ammID = ripple::uint256{54321 };
757+ auto const ammID = ripple::uint256{kAMM_ID };
774758 auto const ammAccountKk = ripple::keylet::account (ammAccount).key ;
775759 auto const ammAccountRoot = createAccountRootObject (kAMM_ACCOUNT , 0 , 2 , 200 , 2 , kINDEX1 , 2 , 0 , ammID);
776760
777761 // accountroot fetched twice, once in isFrozen, once in accountHolds
778- EXPECT_CALL (*backend_, doFetchLedgerObject (ammAccountKk, testing::_, testing::_)). Times ( 2 );
779- ON_CALL (*backend_, doFetchLedgerObject (ammAccountKk, testing::_, testing::_) )
780- .WillByDefault (Return (ammAccountRoot.getSerializer ().peekData ()));
762+ EXPECT_CALL (*backend_, doFetchLedgerObject (ammAccountKk, testing::_, testing::_))
763+ . Times ( 2 )
764+ .WillRepeatedly (Return (ammAccountRoot.getSerializer ().peekData ()));
781765
782766 auto const amm = createAmmObject (kAMM_ACCOUNT , " XRP" , ripple::toBase58 (ripple::xrpAccount ()), " USD" , kISSUER );
783- EXPECT_CALL (*backend_, doFetchLedgerObject (ripple::keylet::amm (ammID).key , testing::_, testing::_)).Times (1 );
784- ON_CALL (*backend_, doFetchLedgerObject (ripple::keylet::amm (ammID).key , testing::_, testing::_))
785- .WillByDefault (testing::Return (amm.getSerializer ().peekData ()));
767+ EXPECT_CALL (*backend_, doFetchLedgerObject (ripple::keylet::amm (ammID).key , testing::_, testing::_))
768+ .WillOnce (Return (amm.getSerializer ().peekData ()));
786769
787770 auto const issuerKk = ripple::keylet::account (issuer).key ;
788771 auto const issuerAccountRoot = createAccountRootObject (kISSUER , 0 , 2 , 200 , 2 , kINDEX1 , 2 , 0 );
789- EXPECT_CALL (*backend_, doFetchLedgerObject (issuerKk, testing::_, testing::_)).Times (1 );
790- ON_CALL (*backend_, doFetchLedgerObject (issuerKk, testing::_, testing::_))
791- .WillByDefault (Return (issuerAccountRoot.getSerializer ().peekData ()));
772+ EXPECT_CALL (*backend_, doFetchLedgerObject (issuerKk, testing::_, testing::_))
773+ .WillOnce (Return (issuerAccountRoot.getSerializer ().peekData ()));
792774
793775 auto const usdRippleState =
794776 createRippleStateLedgerObject (" USD" , kISSUER , 100 , kACCOUNT , 100 , kISSUER , 100 , kTXN_ID , 3 );
795777 auto const usdRippleStateKk = ripple::keylet::line (issuer, account, ripple::to_currency (" USD" )).key ;
796778
797- EXPECT_CALL (*backend_, doFetchLedgerObject (usdRippleStateKk, testing::_, testing::_)).Times (1 );
798- ON_CALL (*backend_, doFetchLedgerObject (usdRippleStateKk, testing::_, testing::_))
799- .WillByDefault (testing::Return (usdRippleState.getSerializer ().peekData ()));
779+ EXPECT_CALL (*backend_, doFetchLedgerObject (usdRippleStateKk, testing::_, testing::_))
780+ .WillOnce (Return (usdRippleState.getSerializer ().peekData ()));
800781
801782 boost::asio::spawn (ctx_, [&, this ](boost::asio::yield_context yield) {
802783 auto ret = accountHolds (
0 commit comments