Buggy code:
public class TestTransactionService extends BasicReusableHostTestCase { public int accountCount = 20 ; private long baseAccountId ; @ Before public void prepare ( ) throws Throwable { } @ Test public void transactionResolution ( ) throws Throwable { } @ Test public void singleUpdate ( ) throws Throwable { } @ Test public void testBasicCRUD ( ) throws Throwable { } @ Test public void testVisibilityWithinTransaction ( ) throws Throwable { } @ Test public void testShortTransactions ( ) throws Throwable { } private String newTransaction ( ) throws Throwable { } private boolean commit ( String txid , int pendingOperations ) throws Throwable { } private boolean abort ( String txid , int pendingOperations ) throws Throwable { } private void updateExampleService ( String txid , URI exampleServiceUri , ExampleServiceState exampleServiceState ) throws Throwable { } private void verifyExampleServiceState ( String txid , URI exampleServiceUri , ExampleServiceState exampleServiceState ) throws Throwable { } private void createAccounts ( String transactionId , int accounts ) throws Throwable { } private void createAccounts ( String transactionId , int accounts , double initialBalance ) throws Throwable { } public void createAccount ( String transactionId , String accountId , TestContext ctx ) throws Throwable { } private void createAccount ( String transactionId , String accountId , double initialBalance , TestContext ctx ) throws Throwable { } private void deleteAccounts ( String transactionId , int accounts ) throws Throwable { } private void countAccounts ( String transactionId , long expected ) throws Throwable { } public void sumAccounts ( String transactionId , double expected ) throws Throwable { Query . Builder queryBuilder = Builder . create ( ) . addKindFieldClause ( TestTransactionService . BankAccountService . BankAccountServiceState . class ) . addFieldClause ( FIELD_NAME_SELF_LINK , ( ( ( ( TestTransactionService . BankAccountService . FACTORY_LINK ) + ( UriUtils . URI_PATH_CHAR ) ) + ( this . baseAccountId ) ) + ( UriUtils . URI_WILDCARD_CHAR ) ) , WILDCARD ) ; boolean createNewTransaction = transactionId == null ; if ( createNewTransaction ) { transactionId = newTransaction ( ) ; this . host . log ( "Created<seq2seq4repair_space>new<seq2seq4repair_space>transaction<seq2seq4repair_space>%s<seq2seq4repair_space>for<seq2seq4repair_space>snapshot<seq2seq4repair_space>read" , transactionId ) ; } else { queryBuilder . addFieldClause ( FIELD_NAME_TRANSACTION_ID , transactionId ) ; } QueryTask task = QueryTask . Builder . createDirectTask ( ) . setQuery ( queryBuilder . build ( ) ) . build ( ) ; this . host . createQueryTaskService ( task , false , true , task , null ) ; double sum = 0 ; for ( String serviceSelfLink : task . results . documentLinks ) { String accountId = serviceSelfLink . substring ( ( ( serviceSelfLink . lastIndexOf ( '//' ) ) + 1 ) ) ; this . host . log ( "Reading<seq2seq4repair_space>account<seq2seq4repair_space>%s" , accountId ) ; TestTransactionService . BankAccountService . BankAccountServiceState account = getAccount ( transactionId , accountId ) ; sum += account . balance ; this . host . log ( "Read<seq2seq4repair_space>account<seq2seq4repair_space>%s,<seq2seq4repair_space>runnin<seq2seq4repair_space>sum=%f" , accountId , sum ) ; } if ( createNewTransaction ) { <START_BUG> commit ( transactionId , task . results . documentLinks . size ( ) ) ; <END_BUG> } assertEquals ( expected , sum , 0 ) ; } private void depositToAccounts ( String transactionId , int accounts , double amountToDeposit ) throws Throwable { } private void depositToAccount ( String transactionId , String accountId , double amountToDeposit , TestContext ctx ) throws Throwable { } private Operation createDepositOperation ( String transactionId , String accountId , double amount ) { } public void withdrawFromAccount ( String transactionId , String accountId , double amountToWithdraw , TestContext ctx ) throws Throwable { } private Operation createWithdrawOperation ( String transactionId , String accountId , double amount ) { } private void verifyAccountBalance ( String transactionId , String accountId , double expectedBalance ) throws Throwable { } private TestTransactionService . BankAccountService . BankAccountServiceState getAccount ( String transactionId , String accountId ) throws Throwable { } private URI getTransactionFactoryUri ( ) { } private URI getAccountFactoryUri ( ) { } private URI buildAccountUri ( String accountId ) { } private boolean operationFailed ( Operation o , Throwable e ) { } private String buildAccountId ( int i ) { } public static class BankAccountService extends StatefulService { public static final String FACTORY_LINK = ( ServiceUriPaths . SAMPLES ) + "//bank-accounts" ; public static class BankAccountServiceState extends ServiceDocument { static final String KIND = Utils . buildKind ( TestTransactionService . BankAccountService . BankAccountServiceState . class ) ; public double balance ; } public static class BankAccountServiceRequest { public static enum Kind { DEPOSIT , WITHDRAW ; } public TestTransactionService . BankAccountService . BankAccountServiceRequest . Kind kind ; public double amount ; } public BankAccountService ( ) { } @ Override public OperationProcessingChain getOperationProcessingChain ( ) { } @ Override public void handleStart ( Operation start ) { } void handlePatchForDeposit ( Operation patch ) { } void handlePatchForWithdraw ( Operation patch ) { } private void validateState ( Operation start ) { } } }

Fix:
abort ( transactionId , task . results . documentLinks . size ( ) ) ;