### Question:
TransactionSimulatorResult { public long getGasEstimate() { return transaction.getGasLimit() - result.getGasRemaining(); } TransactionSimulatorResult(
      final Transaction transaction, final TransactionProcessor.Result result); boolean isSuccessful(); long getGasEstimate(); Bytes getOutput(); ValidationResult<TransactionValidator.TransactionInvalidReason> getValidationResult(); TransactionProcessor.Result getResult(); @Override boolean equals(final Object o); @Override int hashCode();  }### Answer:
@Test public void shouldUseTransactionProcessorResultAndTransactionToCalculateGasEstimate() { transactionSimulatorResult.getGasEstimate(); verify(transaction).getGasLimit(); verify(result).getGasRemaining(); }
@Test public void shouldCalculateCorrectGasEstimateWhenConsumedAllGas() { when(transaction.getGasLimit()).thenReturn(5L); when(result.getGasRemaining()).thenReturn(0L); assertThat(transactionSimulatorResult.getGasEstimate()).isEqualTo(5L); }
@Test public void shouldCalculateCorrectGasEstimateWhenGasWasInsufficient() { when(transaction.getGasLimit()).thenReturn(1L); when(result.getGasRemaining()).thenReturn(-5L); assertThat(transactionSimulatorResult.getGasEstimate()).isEqualTo(6L); }
@Test public void shouldCalculateCorrectGasEstimateWhenGasLimitWasSufficient() { when(transaction.getGasLimit()).thenReturn(10L); when(result.getGasRemaining()).thenReturn(3L); assertThat(transactionSimulatorResult.getGasEstimate()).isEqualTo(7L); }