### Question:
ContractExecutor { TransactionRuntimeResult executeTx(Map<String, Object> serviceMap, Transaction tx) { return getTransactionRuntimeResult(serviceMap, tx); } ContractExecutor(ContractStore contractStore, LogIndexer logIndexer);   }### Answer:
@Test public void executeTxTest() { Transaction tx = generateTx(BigInteger.valueOf(100)); TransactionRuntimeResult res = manager.executeTx(tx); assertEquals(ExecuteStatus.SUCCESS, res.getReceipt().getStatus()); assertEquals(3, res.getChangeValues().size()); assertEquals("100", res.getChangeValues().get(getNamespaceKey(TestConstants.TRANSFER_TO)).get(BALANCE).getAsString()); assertEquals("999900", res.getChangeValues().get(getNamespaceKey(tx.getAddress().toString())).get(BALANCE).getAsString()); assertEquals(0, contractStore.getTmpStateStore().changeValues().size()); assertFalse(contractStore.getReceiptStore().contains(tx.getHash().toString())); Transaction errTx = generateTx(BigInteger.valueOf(10000000)); res = manager.executeTx(errTx); assertEquals(ExecuteStatus.ERROR, res.getReceipt().getStatus()); assertEquals(0, res.getChangeValues().size()); assertEquals(0, contractStore.getTmpStateStore().changeValues().size()); assertFalse(contractStore.getReceiptStore().contains(tx.getHash().toString())); }
@Test public void executeVersionProposalTest() throws DecoderException { JsonObject txBody = ContractTestUtils.contractProposeTxBodyJson(contractVersion.toString(), "activate"); Transaction tx = new TransactionBuilder() .setType(Hex.decodeHex(VERSIONING_TX)) .setTxBody(txBody) .setWallet(wallet) .setBranchId(branchId) .build(); TransactionRuntimeResult result = manager.executeTx(tx); Assert.assertNotNull("TransactionRuntimeResult is null", result); Assert.assertThat(result.getReceipt().getStatus(), CoreMatchers.is(ExecuteStatus.FALSE)); Assert.assertThat(result.getReceipt().getLog().get(0), CoreMatchers.is("Validator verification failed")); }
@Test public void executeVersionVoteTest() throws DecoderException { String txId = "34eec4dcb662e54492e3b69adb1d2dce5d7451ca6d22221c38ce5bc6f8871b51"; JsonObject txBody = ContractTestUtils.contractVoteTxBodyJson(txId, true); Transaction tx = new TransactionBuilder() .setType(Hex.decodeHex(VERSIONING_TX)) .setTxBody(txBody) .setWallet(wallet) .setBranchId(branchId) .build(); TransactionRuntimeResult result = manager.executeTx(tx); Assert.assertNotNull("TransactionRuntimeResult is null", result); Assert.assertThat(result.getReceipt().getStatus(), CoreMatchers.is(ExecuteStatus.FALSE)); }