### Question:
RevertOperation extends AbstractOperation { @Override public OperationResult execute(final MessageFrame frame, final EVM evm) { final UInt256 from = UInt256.fromBytes(frame.popStackItem()); final UInt256 length = UInt256.fromBytes(frame.popStackItem()); final Gas cost = gasCalculator().memoryExpansionGasCost(frame, from, length); final Optional<Gas> optionalCost = Optional.of(cost); if (frame.getRemainingGas().compareTo(cost) < 0) { return new OperationResult(optionalCost, Optional.of(ExceptionalHaltReason.INSUFFICIENT_GAS)); } final Bytes reason = frame.readMemory(from, length); frame.setOutputData(reason); frame.setRevertReason(reason); frame.setState(MessageFrame.State.REVERT); return new OperationResult(optionalCost, Optional.empty()); } RevertOperation(final GasCalculator gasCalculator); @Override OperationResult execute(final MessageFrame frame, final EVM evm);  }### Answer:
@Test public void shouldReturnReason() { final ArgumentCaptor<Bytes> arg = ArgumentCaptor.forClass(Bytes.class); operation.execute(messageFrame, null); Mockito.verify(messageFrame).setRevertReason(arg.capture()); assertThat(arg.getValue()).isEqualTo(revertReasonBytes); }